本文整理汇总了C++中SharedVolumePtr::setFailOverCacheConfig方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedVolumePtr::setFailOverCacheConfig方法的具体用法?C++ SharedVolumePtr::setFailOverCacheConfig怎么用?C++ SharedVolumePtr::setFailOverCacheConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedVolumePtr
的用法示例。
在下文中一共展示了SharedVolumePtr::setFailOverCacheConfig方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foc_ctx
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());
}
示例2:
void
api::setFailOverCacheConfig(const vd::VolumeId& volName,
const boost::optional<vd::FailOverCacheConfig>& maybe_foc_config)
{
SharedVolumePtr v = VolManager::get()->findVolume_(volName);
v->setFailOverCacheConfig(maybe_foc_config);
}
示例3: foc_ctx
TEST_P(SnapshotRestoreTest, TestFailOver)
{
auto foc_ctx(start_one_foc());
auto ns_ptr = make_random_namespace();
SharedVolumePtr v = newVolume(VolumeId("volume1"),
ns_ptr->ns(),
VolumeSize((1 << 18) * 512),
SCOMultiplier(1));
v->setFailOverCacheConfig(foc_ctx->config(GetParam().foc_mode()));
VolumeConfig cfg = v->get_config();
v->createSnapshot(SnapshotName("snap0"));
for(int i = 0; i < 5; ++i)
{
writeToVolume(*v,
0,
4096,
"a");
}
waitForThisBackendWrite(*v);
v->restoreSnapshot(SnapshotName("snap0"));
for(int i = 0; i < 7; ++i)
{
writeToVolume(*v,
8,
4096,
"d");
}
flushFailOverCache(*v);
destroyVolume(v,
DeleteLocalData::T,
RemoveVolumeCompletely::F);
SharedVolumePtr v1 = 0;
v1 = getVolume(VolumeId("volume1"));
ASSERT_FALSE(v1);
restartVolume(cfg);
v1 = getVolume(VolumeId("volume1"));
ASSERT_TRUE(v1 != nullptr);
checkVolume(*v1,0,4096, "\0");
checkVolume(*v1,8,4096, "d");
checkCurrentBackendSize(*v1);
}