]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test / librbd: use data pool IoCtx while listing objects
authorVenky Shankar <vshankar@redhat.com>
Thu, 17 Nov 2016 15:41:40 +0000 (21:11 +0530)
committerVenky Shankar <vshankar@redhat.com>
Sun, 20 Nov 2016 15:51:50 +0000 (21:21 +0530)
Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/test/librbd/test_librbd.cc

index 62a151dcaaa8b8dc0db718d09c883df8c848a142..24015173e068dbe24bdb9662ecf8d988c3bcec83 100644 (file)
@@ -2146,7 +2146,12 @@ TEST_F(TestLibRBD, TestCoR)
 
   // find out what objects the parent image has generated
   ASSERT_EQ(0, rbd_stat(parent, &p_info, sizeof(p_info)));
-  ASSERT_EQ(0, rados_nobjects_list_open(ioctx, &list_ctx));
+
+  int64_t data_pool_id = rbd_get_data_pool_id(parent);
+  rados_ioctx_t d_ioctx;
+  rados_ioctx_create2(_cluster, data_pool_id, &d_ioctx);
+
+  ASSERT_EQ(0, rados_nobjects_list_open(d_ioctx, &list_ctx));
   while (rados_nobjects_list_next(list_ctx, &entry, NULL, NULL) != -ENOENT) {
     if (strstr(entry, p_info.block_name_prefix)) {
       const char *block_name_suffix = entry + strlen(p_info.block_name_prefix) + 1;
@@ -2197,7 +2202,7 @@ TEST_F(TestLibRBD, TestCoR)
   printf("check whether child image has the same set of objects as parent\n");
   ASSERT_EQ(0, rbd_open(ioctx, "child", &child, NULL));
   ASSERT_EQ(0, rbd_stat(child, &c_info, sizeof(c_info)));
-  ASSERT_EQ(0, rados_nobjects_list_open(ioctx, &list_ctx));
+  ASSERT_EQ(0, rados_nobjects_list_open(d_ioctx, &list_ctx));
   while (rados_nobjects_list_next(list_ctx, &entry, NULL, NULL) != -ENOENT) {
     if (strstr(entry, c_info.block_name_prefix)) {
       const char *block_name_suffix = entry + strlen(c_info.block_name_prefix) + 1;
@@ -2212,6 +2217,7 @@ TEST_F(TestLibRBD, TestCoR)
   ASSERT_EQ(0, rbd_close(child));
 
   rados_ioctx_destroy(ioctx);
+  rados_ioctx_destroy(d_ioctx);
 }
 
 static void test_list_children(rbd_image_t image, ssize_t num_expected, ...)