// 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;
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;
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, ...)