本文整理汇总了C++中SharedVolumePtr类的典型用法代码示例。如果您正苦于以下问题:C++ SharedVolumePtr类的具体用法?C++ SharedVolumePtr怎么用?C++ SharedVolumePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SharedVolumePtr类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
api::isVolumeSyncedUpTo(const vd::VolumeId& vol_id,
const vd::TLogId& tlog_id)
{
SharedVolumePtr v = VolManager::get()->findVolume_(vol_id);
return v->isSyncedToBackendUpTo(tlog_id);
}
示例2: TEST_P
TEST_P(OwnerTagTest, constant_tag)
{
auto ns(make_random_namespace());
SharedVolumePtr v = newVolume(*ns);
const VolumeConfig cfg = v->get_config();
destroyVolume(v,
DeleteLocalData::F,
RemoveVolumeCompletely::F);
v = localRestart(ns->ns());
EXPECT_EQ(cfg.owner_tag_,
v->get_config().owner_tag_);
destroyVolume(v,
DeleteLocalData::T,
RemoveVolumeCompletely::F);
restartVolume(cfg);
v = getVolume(cfg.id_);
EXPECT_EQ(cfg.owner_tag_,
v->get_config().owner_tag_);
}
示例3: TEST_P
TEST_P(DtlCheckerTest, auto_recovery)
{
auto ns_ptr = make_random_namespace();
const backend::Namespace& ns = ns_ptr->ns();
SharedVolumePtr v = newVolume("vol1",
ns);
const auto port = get_next_foc_port();
ASSERT_THROW(v->setFailOverCacheConfig(FailOverCacheConfig(FailOverCacheTestSetup::host(),
port,
GetParam().foc_mode())),
fungi::IOException);
ASSERT_EQ(VolumeFailOverState::DEGRADED,
v->getVolumeFailOverState());
auto foc_ctx(start_one_foc());
ASSERT_EQ(port,
foc_ctx->port());
boost::this_thread::sleep_for(2 * dtl_check_interval_);
ASSERT_EQ(VolumeFailOverState::OK_SYNC,
v->getVolumeFailOverState());
}
示例4: TEST_P
TEST_P(BigReadWriteTest, bigReadsOnFull)
{
auto ns_ptr = make_random_namespace();
SharedVolumePtr v = newVolume(VolumeId("volume1"),
ns_ptr->ns());
SCOPED_BLOCK_BACKEND(*v);
size_t csz = v->getClusterSize();
size_t lba_size = v->getLBASize();
const std::string pattern(csz,'a');
size_t scoMul = v->getSCOMultiplier();
for(size_t i = 0;i < 50*scoMul; ++i)
{
writeToVolume(*v, i* csz / lba_size, csz, pattern);
}
// Stop here to manually delete sco's to check error handling
for(size_t i = 0; i < scoMul; ++i)
{
checkVolume(*v,0, csz*scoMul, pattern);
}
}
示例5: TEST_P
TEST_P(SnapshotRestoreTest, snapshot_restoration_on_a_clone)
{
const auto wrns_parent(make_random_namespace());
const std::string parent_name(wrns_parent->ns().str());
SharedVolumePtr parent = newVolume(VolumeId(parent_name),
be::Namespace(parent_name));
const std::string pattern1("before-parent-snapshot");
writeToVolume(*parent,
0,
parent->getClusterSize(),
pattern1);
const SnapshotName parent_snap("parent-snapshot");
parent->createSnapshot(parent_snap);
waitForThisBackendWrite(*parent);
const auto wrns_clone(make_random_namespace());
const std::string clone_name(wrns_clone->ns().str());
SharedVolumePtr clone = createClone(clone_name,
be::Namespace(clone_name),
be::Namespace(parent_name),
parent_snap);
const std::string pattern2("before-clone-snapshot");
writeToVolume(*clone,
0,
clone->getClusterSize(),
pattern2);
const SnapshotName clone_snap("clone-snapshot");
clone->createSnapshot(clone_snap);
waitForThisBackendWrite(*clone);
const std::string pattern3("after-clone-snapshot");
writeToVolume(*clone,
0,
clone->getClusterSize(),
pattern3);
checkVolume(*clone,
0,
clone->getClusterSize(),
pattern3);
restoreSnapshot(*clone,
clone_snap);
checkVolume(*clone,
0,
clone->getClusterSize(),
pattern2);
}
示例6: test_after_tlog
void
test_after_tlog(bool failover)
{
const auto wrns(make_random_namespace());
SharedVolumePtr v = make_volume(*wrns);
const std::string pattern1("Hairdresser On Fire");
{
SCOPED_BLOCK_BACKEND(*v);
writeToVolume(*v,
v->getClusterMultiplier() * CachePage::capacity(),
v->getClusterSize(),
pattern1);
}
v->scheduleBackendSync();
waitForThisBackendWrite(*v);
const std::string pattern2("Such A Little Thing Makes Such A Big Difference");
writeToVolume(*v,
2 * v->getClusterMultiplier() * CachePage::capacity(),
v->getClusterSize(),
pattern2);
const auto ncfgs(node_configs());
if (failover)
{
mds_manager_->stop_one(ncfgs[0]);
checkVolume(*v,
0,
v->getClusterSize(),
"");
}
else
{
const std::vector<MDSNodeConfig> ncfgs2{ ncfgs[1],
ncfgs[0] };
v->updateMetaDataBackendConfig(MDSMetaDataBackendConfig(ncfgs2,
ApplyRelocationsToSlaves::T));
}
check_config(*v,
ncfgs,
true);
checkVolume(*v,
v->getClusterMultiplier() * CachePage::capacity(),
v->getClusterSize(),
pattern1);
checkVolume(*v,
2 * v->getClusterMultiplier() * CachePage::capacity(),
v->getClusterSize(),
pattern2);
destroyVolume(v,
DeleteLocalData::F,
RemoveVolumeCompletely::F);
v = localRestart(wrns->ns());
check_config(*v,
ncfgs,
true);
checkVolume(*v,
v->getClusterMultiplier() * CachePage::capacity(),
v->getClusterSize(),
pattern1);
checkVolume(*v,
2 * v->getClusterMultiplier() * CachePage::capacity(),
v->getClusterSize(),
pattern2);
}
示例7: test_before_tlog
void
test_before_tlog(bool failover)
{
const auto wrns(make_random_namespace());
SharedVolumePtr v = make_volume(*wrns);
const auto ncfgs(node_configs());
const std::string pattern("King Leer");
{
SCOPED_BLOCK_BACKEND(*v);
writeToVolume(*v,
v->getClusterMultiplier() * CachePage::capacity(),
v->getClusterSize(),
pattern);
if (failover)
{
mds_manager_->stop_one(ncfgs[0]);
checkVolume(*v,
0,
v->getClusterSize(),
"");
}
else
{
const std::vector<MDSNodeConfig> ncfgs2{ ncfgs[1],
ncfgs[0] };
v->updateMetaDataBackendConfig(MDSMetaDataBackendConfig(ncfgs2,
ApplyRelocationsToSlaves::T));
}
check_config(*v,
ncfgs,
true);
checkVolume(*v,
v->getClusterMultiplier() * CachePage::capacity(),
v->getClusterSize(),
pattern);
}
destroyVolume(v,
DeleteLocalData::F,
RemoveVolumeCompletely::F);
v = localRestart(wrns->ns());
check_config(*v,
ncfgs,
true);
checkVolume(*v,
v->getClusterMultiplier() * CachePage::capacity(),
v->getClusterSize(),
pattern);
}
示例8: TEST_P
TEST_P(SimpleBackupRestoreTest, rollback_to_previous_snap_if_snapshot_didnt_make_it)
{
auto ns_ptr = make_random_namespace();
const backend::Namespace& nspace = ns_ptr->ns();
// const Namespace nspace;
const VolumeId vid("backup");
auto wov = newWriteOnlyVolume(vid,
nspace,
BackupRole::WanBackupBase);
ASSERT_TRUE(wov);
const auto cfg(wov->get_config());
const std::string pattern("a mysteriously returning message");
const size_t size = 1024 * 1024;
writeToVolume(*wov, 0, size, pattern);
const SnapshotName snap("snap");
wov->createSnapshot(snap);
waitForThisBackendWrite(*wov);
const std::string pattern2("a mysteriously disappearing message");
writeToVolume(*wov, 0, size, pattern2);
wov->scheduleBackendSync();
waitForThisBackendWrite(*wov);
{
SCOPED_DESTROY_WRITE_ONLY_VOLUME_UNBLOCK_BACKEND_FOR_BACKEND_RESTART(wov, 3);
wov->createSnapshot(SnapshotName("snap2"));
const SnapshotPersistor& sp =
wov->getSnapshotManagement().getSnapshotPersistor();
SnapshotManagement::writeSnapshotPersistor(sp,
cm_->newBackendInterface(nspace));
}
const fs::path
cfg_file(make_config_file(nspace,
MaybeString(),
MaybeString(),
MaybeBackupRole(BackupRole::WanBackupNormal)));
bu::Restore(cfg_file,
false,
youtils::GracePeriod(boost::posix_time::seconds(2)))();
{
fungi::ScopedLock l(api::getManagementMutex());
api::backend_restart(nspace,
new_owner_tag(),
PrefetchVolumeData::T,
IgnoreFOCIfUnreachable::T);
}
SharedVolumePtr v = getVolume(vid);
checkVolume(*v, 0, size, pattern);
std::list<SnapshotName> snaps;
v->listSnapshots(snaps);
EXPECT_EQ(1U, snaps.size());
EXPECT_EQ(snap, snaps.front());
}