当前位置: 首页>>代码示例>>C++>>正文


C++ SharedVolumePtr::createSnapshot方法代码示例

本文整理汇总了C++中SharedVolumePtr::createSnapshot方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedVolumePtr::createSnapshot方法的具体用法?C++ SharedVolumePtr::createSnapshot怎么用?C++ SharedVolumePtr::createSnapshot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SharedVolumePtr的用法示例。


在下文中一共展示了SharedVolumePtr::createSnapshot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wrns_parent

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);
}
开发者ID:bigclouds,项目名称:volumedriver,代码行数:60,代码来源:SnapshotRestoreTest.cpp

示例2: 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);
}
开发者ID:bigclouds,项目名称:volumedriver,代码行数:50,代码来源:SnapshotRestoreTest.cpp

示例3: newVolume

TEST_P(SnapshotRestoreTest, RestoreAndWriteAgain2)
{
    auto ns_ptr = make_random_namespace();
    SharedVolumePtr v = newVolume(VolumeId("volume1"),
                          ns_ptr->ns(),
                          VolumeSize(1 << 26),
                          SCOMultiplier(1));

    const std::string pattern("e-manual");

    v->createSnapshot(SnapshotName("snap1"));
    waitForThisBackendWrite(*v);

    writeToVolume(*v, 0, 5 * 4096, pattern);
    v->createSnapshot(SnapshotName("snap2"));
    waitForThisBackendWrite(*v);

    restoreSnapshot(*v,"snap1");

    writeToVolume(*v, 0, 10*4096, pattern);
    waitForThisBackendWrite(*v);
    checkCurrentBackendSize(*v);
}
开发者ID:bigclouds,项目名称:volumedriver,代码行数:23,代码来源:SnapshotRestoreTest.cpp

示例4: tlog_id

TEST_P(SnapshotRestoreTest, HaltOnError)
{
    auto ns_ptr = make_random_namespace();
    SharedVolumePtr v = newVolume(VolumeId("volume1"),
                          ns_ptr->ns());

    const std::string pattern1("blah");

    const TLogId tlog_id(v->getSnapshotManagement().getCurrentTLogId());

    writeToVolume(*v, 0, 4096, pattern1);
    v->createSnapshot(SnapshotName("snap1"));
    waitForThisBackendWrite(*v);

    EXPECT_THROW(restoreSnapshot(*v, "snap42"),
                 std::exception);
    EXPECT_FALSE(v->is_halted());

    v->getBackendInterface()->remove(boost::lexical_cast<std::string>(tlog_id));
    EXPECT_THROW(restoreSnapshot(*v, "snap1"),
                 std::exception);
    EXPECT_TRUE(v->is_halted());
}
开发者ID:bigclouds,项目名称:volumedriver,代码行数:23,代码来源:SnapshotRestoreTest.cpp


注:本文中的SharedVolumePtr::createSnapshot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。