From b6dd408c87b384ce88b097f706f324e50fc61ace Mon Sep 17 00:00:00 2001 From: Laura Flores Date: Tue, 8 Jul 2025 14:49:03 -0400 Subject: [PATCH] test: remove unit tests about cache tiering Cache tiering was deprecated in the Reef release, so we are no longer supporting any issues related to it. Ref: https://docs.ceph.com/en/latest/rados/operations/cache-tiering/ Fixes: https://tracker.ceph.com/issues/70917 Signed-off-by: Laura Flores --- src/test/librbd/test_librbd.cc | 193 --------------------- src/test/rbd_mirror/test_ClusterWatcher.cc | 56 ------ 2 files changed, 249 deletions(-) diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index 1eb7fdeb28d90..a0c2c9ef6d14f 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -6990,199 +6990,6 @@ TEST_F(TestLibRBD, ListChildren) rados_ioctx_destroy(ioctx2); } -TEST_F(TestLibRBD, ListChildrenTiered) -{ - SKIP_IF_CRIMSON(); - REQUIRE_FEATURE(RBD_FEATURE_LAYERING); - - librbd::RBD rbd; - string pool_name1 = create_pool(true); - string pool_name2 = create_pool(true); - string pool_name3 = create_pool(true); - ASSERT_NE("", pool_name1); - ASSERT_NE("", pool_name2); - ASSERT_NE("", pool_name3); - - std::string cmdstr = "{\"prefix\": \"osd tier add\", \"pool\": \"" + - pool_name1 + "\", \"tierpool\":\"" + pool_name3 + "\", \"force_nonempty\":\"\"}"; - char *cmd[1]; - cmd[0] = (char *)cmdstr.c_str(); - ASSERT_EQ(0, rados_mon_command(_cluster, (const char **)cmd, 1, "", 0, NULL, 0, NULL, 0)); - - cmdstr = "{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + - pool_name3 + "\", \"mode\":\"writeback\"}"; - cmd[0] = (char *)cmdstr.c_str(); - ASSERT_EQ(0, rados_mon_command(_cluster, (const char **)cmd, 1, "", 0, NULL, 0, NULL, 0)); - - cmdstr = "{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + - pool_name1 + "\", \"overlaypool\":\"" + pool_name3 + "\"}"; - cmd[0] = (char *)cmdstr.c_str(); - ASSERT_EQ(0, rados_mon_command(_cluster, (const char **)cmd, 1, "", 0, NULL, 0, NULL, 0)); - - EXPECT_EQ(0, rados_wait_for_latest_osdmap(_cluster)); - - string parent_name = get_temp_image_name(); - string child_name1 = get_temp_image_name(); - string child_name2 = get_temp_image_name(); - string child_name3 = get_temp_image_name(); - string child_name4 = get_temp_image_name(); - - char child_id1[4096]; - char child_id2[4096]; - char child_id3[4096]; - char child_id4[4096]; - - rbd_image_t image1; - rbd_image_t image2; - rbd_image_t image3; - rbd_image_t image4; - - rados_ioctx_t ioctx1, ioctx2; - rados_ioctx_create(_cluster, pool_name1.c_str(), &ioctx1); - rados_ioctx_create(_cluster, pool_name2.c_str(), &ioctx2); - - bool old_format; - uint64_t features; - rbd_image_t parent; - int order = 0; - - ASSERT_EQ(0, get_features(&old_format, &features)); - ASSERT_FALSE(old_format); - - // make a parent to clone from - ASSERT_EQ(0, create_image_full(ioctx1, parent_name.c_str(), 4<<20, &order, - false, features)); - ASSERT_EQ(0, rbd_open(ioctx1, parent_name.c_str(), &parent, NULL)); - // create a snapshot, reopen as the parent we're interested in - ASSERT_EQ(0, rbd_snap_create(parent, "parent_snap")); - ASSERT_EQ(0, rbd_snap_set(parent, "parent_snap")); - ASSERT_EQ(0, rbd_snap_protect(parent, "parent_snap")); - - ASSERT_EQ(0, rbd_close(parent)); - ASSERT_EQ(0, rbd_open(ioctx1, parent_name.c_str(), &parent, "parent_snap")); - - ASSERT_EQ(0, clone_image(ioctx1, parent, parent_name.c_str(), "parent_snap", - ioctx2, child_name1.c_str(), features, &order)); - ASSERT_EQ(0, rbd_open(ioctx2, child_name1.c_str(), &image1, NULL)); - ASSERT_EQ(0, rbd_get_id(image1, child_id1, sizeof(child_id1))); - test_list_children(parent, 1, pool_name2.c_str(), child_name1.c_str()); - test_list_children2(parent, 1, - child_id1, pool_name2.c_str(), child_name1.c_str(), false); - - ASSERT_EQ(0, clone_image(ioctx1, parent, parent_name.c_str(), "parent_snap", - ioctx1, child_name2.c_str(), features, &order)); - ASSERT_EQ(0, rbd_open(ioctx1, child_name2.c_str(), &image2, NULL)); - ASSERT_EQ(0, rbd_get_id(image2, child_id2, sizeof(child_id2))); - test_list_children(parent, 2, pool_name2.c_str(), child_name1.c_str(), - pool_name1.c_str(), child_name2.c_str()); - test_list_children2(parent, 2, - child_id1, pool_name2.c_str(), child_name1.c_str(), false, - child_id2, pool_name1.c_str(), child_name2.c_str(), false); - - // read from the cache to populate it - rbd_image_t tier_image; - ASSERT_EQ(0, rbd_open(ioctx1, child_name2.c_str(), &tier_image, NULL)); - size_t len = 4 * 1024 * 1024; - char* buf = (char*)malloc(len); - ssize_t size = rbd_read(tier_image, 0, len, buf); - ASSERT_GT(size, 0); - free(buf); - ASSERT_EQ(0, rbd_close(tier_image)); - - ASSERT_EQ(0, clone_image(ioctx1, parent, parent_name.c_str(), "parent_snap", - ioctx2, child_name3.c_str(), features, &order)); - ASSERT_EQ(0, rbd_open(ioctx2, child_name3.c_str(), &image3, NULL)); - ASSERT_EQ(0, rbd_get_id(image3, child_id3, sizeof(child_id3))); - test_list_children(parent, 3, pool_name2.c_str(), child_name1.c_str(), - pool_name1.c_str(), child_name2.c_str(), - pool_name2.c_str(), child_name3.c_str()); - test_list_children2(parent, 3, - child_id1, pool_name2.c_str(), child_name1.c_str(), false, - child_id2, pool_name1.c_str(), child_name2.c_str(), false, - child_id3, pool_name2.c_str(), child_name3.c_str(), false); - - librados::IoCtx ioctx3; - ASSERT_EQ(0, _rados.ioctx_create(pool_name2.c_str(), ioctx3)); - ASSERT_EQ(0, rbd_close(image3)); - ASSERT_EQ(0, rbd.trash_move(ioctx3, child_name3.c_str(), 0)); - test_list_children(parent, 2, pool_name2.c_str(), child_name1.c_str(), - pool_name1.c_str(), child_name2.c_str()); - test_list_children2(parent, 3, - child_id1, pool_name2.c_str(), child_name1.c_str(), false, - child_id2, pool_name1.c_str(), child_name2.c_str(), false, - child_id3, pool_name2.c_str(), child_name3.c_str(), true); - - ASSERT_EQ(0, clone_image(ioctx1, parent, parent_name.c_str(), "parent_snap", - ioctx2, child_name4.c_str(), features, &order)); - ASSERT_EQ(0, rbd_open(ioctx2, child_name4.c_str(), &image4, NULL)); - ASSERT_EQ(0, rbd_get_id(image4, child_id4, sizeof(child_id4))); - test_list_children(parent, 3, pool_name2.c_str(), child_name1.c_str(), - pool_name1.c_str(), child_name2.c_str(), - pool_name2.c_str(), child_name4.c_str()); - test_list_children2(parent, 4, - child_id1, pool_name2.c_str(), child_name1.c_str(), false, - child_id2, pool_name1.c_str(), child_name2.c_str(), false, - child_id3, pool_name2.c_str(), child_name3.c_str(), true, - child_id4, pool_name2.c_str(), child_name4.c_str(), false); - - ASSERT_EQ(0, rbd.trash_restore(ioctx3, child_id3, "")); - test_list_children(parent, 4, pool_name2.c_str(), child_name1.c_str(), - pool_name1.c_str(), child_name2.c_str(), - pool_name2.c_str(), child_name3.c_str(), - pool_name2.c_str(), child_name4.c_str()); - test_list_children2(parent, 4, - child_id1, pool_name2.c_str(), child_name1.c_str(), false, - child_id2, pool_name1.c_str(), child_name2.c_str(), false, - child_id3, pool_name2.c_str(), child_name3.c_str(), false, - child_id4, pool_name2.c_str(), child_name4.c_str(), false); - - ASSERT_EQ(0, rbd_close(image1)); - ASSERT_EQ(0, rbd_remove(ioctx2, child_name1.c_str())); - test_list_children(parent, 3, - pool_name1.c_str(), child_name2.c_str(), - pool_name2.c_str(), child_name3.c_str(), - pool_name2.c_str(), child_name4.c_str()); - test_list_children2(parent, 3, - child_id2, pool_name1.c_str(), child_name2.c_str(), false, - child_id3, pool_name2.c_str(), child_name3.c_str(), false, - child_id4, pool_name2.c_str(), child_name4.c_str(), false); - - ASSERT_EQ(0, rbd_remove(ioctx2, child_name3.c_str())); - test_list_children(parent, 2, - pool_name1.c_str(), child_name2.c_str(), - pool_name2.c_str(), child_name4.c_str()); - test_list_children2(parent, 2, - child_id2, pool_name1.c_str(), child_name2.c_str(), false, - child_id4, pool_name2.c_str(), child_name4.c_str(), false); - - ASSERT_EQ(0, rbd_close(image4)); - ASSERT_EQ(0, rbd_remove(ioctx2, child_name4.c_str())); - test_list_children(parent, 1, - pool_name1.c_str(), child_name2.c_str()); - test_list_children2(parent, 1, - child_id2, pool_name1.c_str(), child_name2.c_str(), false); - - ASSERT_EQ(0, rbd_close(image2)); - ASSERT_EQ(0, rbd_remove(ioctx1, child_name2.c_str())); - test_list_children(parent, 0); - test_list_children2(parent, 0); - - ASSERT_EQ(0, rbd_snap_unprotect(parent, "parent_snap")); - ASSERT_EQ(0, rbd_snap_remove(parent, "parent_snap")); - ASSERT_EQ(0, rbd_close(parent)); - ASSERT_EQ(0, rbd_remove(ioctx1, parent_name.c_str())); - rados_ioctx_destroy(ioctx1); - rados_ioctx_destroy(ioctx2); - cmdstr = "{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + - pool_name1 + "\"}"; - cmd[0] = (char *)cmdstr.c_str(); - ASSERT_EQ(0, rados_mon_command(_cluster, (const char **)cmd, 1, "", 0, NULL, 0, NULL, 0)); - cmdstr = "{\"prefix\": \"osd tier remove\", \"pool\": \"" + - pool_name1 + "\", \"tierpool\":\"" + pool_name3 + "\"}"; - cmd[0] = (char *)cmdstr.c_str(); - ASSERT_EQ(0, rados_mon_command(_cluster, (const char **)cmd, 1, "", 0, NULL, 0, NULL, 0)); -} - TEST_F(TestLibRBD, LockingPP) { librados::IoCtx ioctx; diff --git a/src/test/rbd_mirror/test_ClusterWatcher.cc b/src/test/rbd_mirror/test_ClusterWatcher.cc index 005a83c1d8ec9..20b9b48dda737 100644 --- a/src/test/rbd_mirror/test_ClusterWatcher.cc +++ b/src/test/rbd_mirror/test_ClusterWatcher.cc @@ -122,42 +122,6 @@ public: "}", in_bl, nullptr, nullptr)); } - void create_cache_pool(const string &base_pool, string *cache_pool_name) { - bufferlist inbl; - *cache_pool_name = get_temp_pool_name("test-rbd-mirror-"); - ASSERT_EQ(0, m_cluster->pool_create(cache_pool_name->c_str())); - - ASSERT_EQ(0, m_cluster->mon_command( - "{\"prefix\": \"osd tier add\", \"pool\": \"" + base_pool + - "\", \"tierpool\": \"" + *cache_pool_name + - "\", \"force_nonempty\": \"--force-nonempty\" }", - inbl, NULL, NULL)); - ASSERT_EQ(0, m_cluster->mon_command( - "{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + base_pool + - "\", \"overlaypool\": \"" + *cache_pool_name + "\"}", - inbl, NULL, NULL)); - ASSERT_EQ(0, m_cluster->mon_command( - "{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + *cache_pool_name + - "\", \"mode\": \"writeback\"}", - inbl, NULL, NULL)); - m_cluster->wait_for_latest_osdmap(); - } - - void remove_cache_pool(const string &base_pool, const string &cache_pool) { - bufferlist inbl; - // tear down tiers - ASSERT_EQ(0, m_cluster->mon_command( - "{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + base_pool + - "\"}", - inbl, NULL, NULL)); - ASSERT_EQ(0, m_cluster->mon_command( - "{\"prefix\": \"osd tier remove\", \"pool\": \"" + base_pool + - "\", \"tierpool\": \"" + cache_pool + "\"}", - inbl, NULL, NULL)); - m_cluster->wait_for_latest_osdmap(); - m_cluster->pool_delete(cache_pool.c_str()); - } - void check_peers() { m_cluster_watcher->refresh_pools(); std::lock_guard l{m_lock}; @@ -212,26 +176,6 @@ TEST_F(TestClusterWatcher, ReplicatedPools) { check_peers(); } -TEST_F(TestClusterWatcher, CachePools) { - PeerSpec site1("", "site1", "mirror1"); - string base1, base2, cache1, cache2; - create_pool(true, site1, &site1.uuid, &base1); - check_peers(); - - create_cache_pool(base1, &cache1); - BOOST_SCOPE_EXIT( base1, cache1, this_ ) { - this_->remove_cache_pool(base1, cache1); - } BOOST_SCOPE_EXIT_END; - check_peers(); - - create_pool(false, PeerSpec(), nullptr, &base2); - create_cache_pool(base2, &cache2); - BOOST_SCOPE_EXIT( base2, cache2, this_ ) { - this_->remove_cache_pool(base2, cache2); - } BOOST_SCOPE_EXIT_END; - check_peers(); -} - TEST_F(TestClusterWatcher, ConfigKey) { REQUIRE(!is_librados_test_stub(*m_cluster)); -- 2.39.5