From: Jason Dillaman Date: Tue, 25 Aug 2015 20:21:34 +0000 (-0400) Subject: tests: new watch/notify rename image tests X-Git-Tag: v10.0.2~193^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=59a7615a6af8c19085e320e0470ec4fe10f6b155;p=ceph.git tests: new watch/notify rename image tests Signed-off-by: Jason Dillaman --- diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index 1d9f8e9c4f8..b578a25792c 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -2697,6 +2697,38 @@ TEST_F(TestLibRBD, TestPendingAio) rados_ioctx_destroy(ioctx); } +TEST_F(TestLibRBD, RenameViaLockOwner) +{ + REQUIRE_FEATURE(RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK); + + librados::IoCtx ioctx; + ASSERT_EQ(0, _rados.ioctx_create(m_pool_name.c_str(), ioctx)); + + librbd::RBD rbd; + std::string name = get_temp_image_name(); + uint64_t size = 2 << 20; + int order = 0; + ASSERT_EQ(0, create_image_pp(rbd, ioctx, name.c_str(), size, &order)); + + librbd::Image image1; + ASSERT_EQ(0, rbd.open(ioctx, image1, name.c_str(), NULL)); + + bufferlist bl; + ASSERT_EQ(0, image1.write(0, 0, bl)); + + bool lock_owner; + ASSERT_EQ(0, image1.is_exclusive_lock_owner(&lock_owner)); + ASSERT_TRUE(lock_owner); + + std::string new_name = get_temp_image_name(); + ASSERT_EQ(0, rbd.rename(ioctx, name.c_str(), new_name.c_str())); + ASSERT_EQ(0, image1.is_exclusive_lock_owner(&lock_owner)); + ASSERT_TRUE(lock_owner); + + librbd::Image image2; + ASSERT_EQ(0, rbd.open(ioctx, image2, new_name.c_str(), NULL)); +} + TEST_F(TestLibRBD, SnapCreateViaLockOwner) { REQUIRE_FEATURE(RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK);