Exemple #1
0
def test_context_manager():
    with Rados(conffile='') as cluster:
        with cluster.open_ioctx(pool_name) as ioctx:
            image_name = get_temp_image_name()
            RBD().create(ioctx, image_name, IMG_SIZE)
            with Image(ioctx, image_name) as image:
                data = rand_data(256)
                image.write(data, 0)
                read = image.read(0, 256)
            RBD().remove(ioctx, image_name)
            eq(data, read)
def delete_image(ioctx, img_name):
    image = Image(ioctx, img_name)
    for snap in image.list_snaps():
        snap_name = snap['name']
        print("removing snapshot: %s@%s" % (img_name, snap_name))
        if image.is_protected_snap(snap_name):
            image.unprotect_snap(snap_name)
        image.remove_snap(snap_name)
    image.close()
    print("removing image: %s" % img_name)
    RBD().remove(ioctx, img_name)
Exemple #3
0
 def test_flatten_drops_cache(self):
     global ioctx
     global features
     clone_name2 = get_temp_image_name()
     self.rbd.clone(ioctx, image_name, 'snap1', ioctx, clone_name2,
                    features, IMG_ORDER)
     with Image(ioctx, clone_name2) as clone:
         with Image(ioctx, clone_name2) as clone2:
             # cache object non-existence
             data = clone.read(IMG_SIZE // 2, 256)
             clone2_data = clone2.read(IMG_SIZE // 2, 256)
             eq(data, clone2_data)
             clone.flatten()
             assert_raises(ImageNotFound, clone.parent_info)
             assert_raises(ImageNotFound, clone2.parent_info)
             after_flatten = clone.read(IMG_SIZE // 2, 256)
             eq(data, after_flatten)
             after_flatten = clone2.read(IMG_SIZE // 2, 256)
             eq(data, after_flatten)
     self.rbd.remove(ioctx, clone_name2)
Exemple #4
0
 def test_copy(self):
     global ioctx
     data = rand_data(256)
     self.image.write(data, 256)
     self.image.copy(ioctx, IMG_NAME + '2')
     assert_raises(ImageExists, self.image.copy, ioctx, IMG_NAME + '2')
     copy = Image(ioctx, IMG_NAME + '2')
     copy_data = copy.read(256, 256)
     copy.close()
     self.rbd.remove(ioctx, IMG_NAME + '2')
     eq(data, copy_data)
Exemple #5
0
def check_default_params(format, order=None, features=None, stripe_count=None,
                         stripe_unit=None, exception=None):
    global rados
    global ioctx
    orig_vals = {}
    for k in ['rbd_default_format', 'rbd_default_order', 'rbd_default_features',
              'rbd_default_stripe_count', 'rbd_default_stripe_unit']:
        orig_vals[k] = rados.conf_get(k)
    try:
        rados.conf_set('rbd_default_format', str(format))
        if order is not None:
            rados.conf_set('rbd_default_order', str(order or 0))
        if features is not None:
            rados.conf_set('rbd_default_features', str(features or 0))
        if stripe_count is not None:
            rados.conf_set('rbd_default_stripe_count', str(stripe_count or 0))
        if stripe_unit is not None:
            rados.conf_set('rbd_default_stripe_unit', str(stripe_unit or 0))
        image_name = get_temp_image_name()
        if exception is None:
            RBD().create(ioctx, image_name, IMG_SIZE)
            try:
                with Image(ioctx, image_name) as image:
                    eq(format == 1, image.old_format())

                    expected_order = order
                    if not order:
                        expected_order = 22
                    actual_order = image.stat()['order']
                    eq(expected_order, actual_order)

                    expected_features = features
                    if expected_features is None or format == 1:
                        expected_features = 0 if format == 1 else 7
                    eq(expected_features, image.features())

                    expected_stripe_count = stripe_count
                    if not expected_stripe_count or format == 1 or \
                           features & RBD_FEATURE_STRIPINGV2 == 0:
                        expected_stripe_count = 1
                    eq(expected_stripe_count, image.stripe_count())

                    expected_stripe_unit = stripe_unit
                    if not expected_stripe_unit or format == 1 or \
                           features & RBD_FEATURE_STRIPINGV2 == 0:
                        expected_stripe_unit = 1 << actual_order
                    eq(expected_stripe_unit, image.stripe_unit())
            finally:
                RBD().remove(ioctx, image_name)
        else:
            assert_raises(exception, RBD().create, ioctx, image_name, IMG_SIZE)
    finally:
        for k, v in orig_vals.iteritems():
            rados.conf_set(k, v)
def master(ioctx):
    print("starting master")
    safe_delete_image(ioctx, CLONE_IMG_RENAME)
    safe_delete_image(ioctx, CLONE_IMG_NAME)
    safe_delete_image(ioctx, PARENT_IMG_NAME)

    features = get_features()
    RBD().create(ioctx,
                 PARENT_IMG_NAME,
                 IMG_SIZE,
                 IMG_ORDER,
                 old_format=False,
                 features=features)
    with Image(ioctx, PARENT_IMG_NAME) as image:
        image.create_snap('snap1')
        image.protect_snap('snap1')

    RBD().clone(ioctx,
                PARENT_IMG_NAME,
                'snap1',
                ioctx,
                CLONE_IMG_NAME,
                features=features)
    with Image(ioctx, CLONE_IMG_NAME) as image:
        print("acquiring exclusive lock")
        offset = 0
        data = os.urandom(512)
        while offset < IMG_SIZE:
            image.write(data, offset)
            offset += (1 << IMG_ORDER)
        image.write(b'1', IMG_SIZE - 1)
        assert (image.is_exclusive_lock_owner())

        print("waiting for slave to complete")
        while image.is_exclusive_lock_owner():
            time.sleep(5)

    safe_delete_image(ioctx, CLONE_IMG_RENAME)
    safe_delete_image(ioctx, CLONE_IMG_NAME)
    delete_image(ioctx, PARENT_IMG_NAME)
    print("finished")
Exemple #7
0
 def test_copy(self):
     global ioctx
     data = rand_data(256)
     self.image.write(data, 256)
     image_name = get_temp_image_name()
     self.image.copy(ioctx, image_name)
     assert_raises(ImageExists, self.image.copy, ioctx, image_name)
     copy = Image(ioctx, image_name)
     copy_data = copy.read(256, 256)
     copy.close()
     self.rbd.remove(ioctx, image_name)
     eq(data, copy_data)
Exemple #8
0
 def test_flatten_multi_level(self):
     self.clone.create_snap('snap2')
     self.clone.protect_snap('snap2')
     clone_name3 = get_temp_image_name()
     self.rbd.clone(ioctx, self.clone_name, 'snap2', ioctx, clone_name3,
                    features)
     self.clone.flatten()
     with Image(ioctx, clone_name3) as clone3:
         clone3.flatten()
     self.clone.unprotect_snap('snap2')
     self.clone.remove_snap('snap2')
     self.rbd.remove(ioctx, clone_name3)
Exemple #9
0
    def get_rbd_stat(self, rbd_name):
        try:
            image = Image(self.ioctx, rbd_name)
            stat = image.stat()
            image.close()

            self.log.info(("stat of rbd image %s" % rbd_name, stat))
            return stat
        except Exception as e:
            self.log.error("unable to get stat of rbd image (%s). %s" %
                           (rbd_name, e))
            return False
Exemple #10
0
    def get_rbd_features(self, rbd_name):
        try:
            image = Image(self.ioctx, rbd_name)
            feature = image.features()
            self.log.info("feature of rbd image %s = %s" % (rbd_name, feature))
            image.close()

            return feature
        except Exception as e:
            self.log.error("unable to get feature of rbd image (%s). %s" %
                           (rbd_name, e))
            return False
Exemple #11
0
def slave(ioctx):
    print("starting slave")

    while True:
        try:
            with Image(ioctx, CLONE_IMG_NAME) as image:
                if (image.list_lockers() != []
                        and image.read(IMG_SIZE - 1, 1) == '1'):
                    break
        except Exception:
            pass

    with Image(ioctx, CLONE_IMG_NAME) as image:
        print("detected master")

        print("flatten")
        image.flatten()
        assert (not image.is_exclusive_lock_owner())

        print("resize")
        image.resize(IMG_SIZE / 2)
        assert (not image.is_exclusive_lock_owner())
        assert (image.stat()['size'] == IMG_SIZE / 2)

        print("create_snap")
        image.create_snap('snap1')
        assert (not image.is_exclusive_lock_owner())
        assert ('snap1' in map(lambda snap: snap['name'], image.list_snaps()))

        print("remove_snap")
        image.remove_snap('snap1')
        assert (not image.is_exclusive_lock_owner())
        assert (list(image.list_snaps()) == [])

        print("write")
        data = os.urandom(512)
        image.write(data, 0)
        assert (image.is_exclusive_lock_owner())

        print("finished")
Exemple #12
0
def test_open_read_only():
    with Rados(conffile='') as cluster:
        with cluster.open_ioctx('rbd') as ioctx:
            RBD().create(ioctx, IMG_NAME, IMG_SIZE)
            data = rand_data(256)
            with Image(ioctx, IMG_NAME) as image:
                image.write(data, 0)
                image.create_snap('snap')
            with Image(ioctx, IMG_NAME, read_only=True) as image:
                read = image.read(0, 256)
                eq(data, read)
                assert_raises(ReadOnlyImage, image.write, data, 0)
                assert_raises(ReadOnlyImage, image.create_snap, 'test')
                assert_raises(ReadOnlyImage, image.remove_snap, 'snap')
                assert_raises(ReadOnlyImage, image.rollback_to_snap, 'snap')
                assert_raises(ReadOnlyImage, image.protect_snap, 'snap')
                assert_raises(ReadOnlyImage, image.unprotect_snap, 'snap')
                assert_raises(ReadOnlyImage, image.unprotect_snap, 'snap')
                assert_raises(ReadOnlyImage, image.flatten)
            with Image(ioctx, IMG_NAME) as image:
                image.remove_snap('snap')
            RBD().remove(ioctx, IMG_NAME)
            eq(data, read)
Exemple #13
0
 def test_create_snap(self):
     global ioctx
     self.image.create_snap('snap1')
     read = self.image.read(0, 256)
     eq(read, b'\0' * 256)
     data = rand_data(256)
     self.image.write(data, 0)
     read = self.image.read(0, 256)
     eq(read, data)
     at_snapshot = Image(ioctx, image_name, 'snap1')
     snap_data = at_snapshot.read(0, 256)
     at_snapshot.close()
     eq(snap_data, b'\0' * 256)
     self.image.remove_snap('snap1')
Exemple #14
0
def rbd_read(dbg, cluster, pool, name, offset, length):
    log.debug(
        "%s: xcpng.librbd.rbd_utils.rbd_read: Cluster ID: %s Pool: %s Name: %s Offset: %s Length: %s"
        % (dbg, cluster.get_fsid(), pool, name, offset, length))
    ioctx = cluster.open_ioctx(pool)
    try:
        image = Image(ioctx, name)
        return image.read(offset, length)
    except ImageBusy or ImageExists as e:
        log.error(
            "%s: xcpng.librbd.rbd_utils.rbd_read: Failed to read from the image: Cluster ID: %s Pool: %s Name: %s"
            % (dbg, cluster.get_fsid(), pool, name))
        raise Exception(e)
    finally:
        ioctx.close()
Exemple #15
0
 def test_follower_flatten(self):
     with Image(ioctx, image_name) as image:
         image.create_snap('snap')
         image.protect_snap('snap')
     try:
         RBD().clone(ioctx, image_name, 'snap', ioctx, 'clone', features)
         with Image(ioctx, 'clone') as image1, Image(ioctx2, 'clone') as image2:
             data = rand_data(256)
             image1.write(data, 0)
             image2.flatten()
             assert_raises(ImageNotFound, image1.parent_info)
             parent = True
             for x in range(30):
                 try:
                     image2.parent_info()
                 except ImageNotFound:
                     parent = False
                     break
             eq(False, parent)
     finally:
         RBD().remove(ioctx, 'clone')
         with Image(ioctx, image_name) as image:
             image.unprotect_snap('snap')
             image.remove_snap('snap')
Exemple #16
0
def rbd_write(dbg, cluster, pool, name, data, offset, length):
    log.debug(
        "%s: xcpng.librbd.rbd_utils.rbd_wite: Cluster ID: %s Pool: %s Name: %s Offset: %s Length: %s"
        % (dbg, cluster.get_fsid(), pool, name, offset, length))
    ioctx = cluster.open_ioctx(pool)
    try:
        image = Image(ioctx, name)
        image.write(data, offset)
    except ImageBusy or ImageExists as e:
        log.error(
            "%s: xcpng.librbd.rbd_utils.rbd_lock: Failed to write to the image: Cluster ID: %s Pool: %s Name: %s"
            % (dbg, cluster.get_fsid(), pool, name))
        raise Exception(e)
    finally:
        ioctx.close()
Exemple #17
0
 def test_create_with_params(self):
     global features
     image_name = get_temp_image_name()
     order = 20
     stripe_unit = 1 << 20
     stripe_count = 10
     self.rbd.create(ioctx, image_name, IMG_SIZE, order, False, features,
                     stripe_unit, stripe_count)
     image = Image(ioctx, image_name)
     info = image.stat()
     check_stat(info, IMG_SIZE, order)
     eq(image.features(), features)
     eq(image.stripe_unit(), stripe_unit)
     eq(image.stripe_count(), stripe_count)
     image.close()
     RBD().remove(ioctx, image_name)
Exemple #18
0
def rbd_resize(dbg, cluster, pool, name, size):
    log.debug(
        "%s: xcpng.librbd.rbd_utils.rbd_resize: Cluster ID: %s Pool: %s Name: %s Size: %s"
        % (dbg, cluster.get_fsid(), pool, name, size))
    ioctx = cluster.open_ioctx(pool)
    image = Image(ioctx, name)

    try:
        image.resize(size)
    except Exception as e:
        log.error(
            "%s: xcpng.librbd.rbd_utils.rbd_resize: Failed to resize an image: Cluster ID: %s Pool %s Name: %s Size: %s"
            % (dbg, cluster.get_fsid(), pool, name, size))
        raise Exception(e)
    finally:
        ioctx.close()
    def get_rbd_size(self, rbd_name):
        try:
            if self.ioctx == None:
                self.log.error("Pool ioctx is not opened yet.")
                return False

            image = Image(self.ioctx, rbd_name)
            size = image.size()
            self.log.debug("Size of RBD '%s/%s' in Ceph cluster is %s." %
                           (self.pool_name, rbd_name, size))
            return size
        except Exception as e:
            self.log.error("Fail to get RBD size. %s" % e)
            return False
        finally:
            image.close()
Exemple #20
0
def rbd_snapshot(dbg, cluster, pool, name, snapshot):
    log.debug(
        "%s: xcpng.librbd.rbd_utils.rbd_snapshot: Cluster ID: %s Pool: %s Name: %s Snapshot: %s"
        % (dbg, cluster.get_fsid(), pool, name, snapshot))
    ioctx = cluster.open_ioctx(pool)
    image = Image(ioctx, name)

    try:
        image.create_snap(snapshot)
    except Exception as e:
        log.error(
            "%s: xcpng.librbd.rbd_utils.rbd_clone: Failed to take a snapshot: Cluster ID: %s Pool: %s Name: %s Snapshot: %s"
            % (dbg, cluster.get_fsid(), pool, name, snapshot))
        raise Exception(e)
    finally:
        ioctx.close()
Exemple #21
0
def rbd_lock(dbg, cluster, pool, name):
    log.debug(
        "%s: xcpng.librbd.rbd_utils.rbd_lock: Cluster ID: %s Pool: %s Name: %s"
        % (dbg, cluster.get_fsid(), pool, name))
    ioctx = cluster.open_ioctx(pool)
    image = Image(ioctx, name)
    try:
        image.lock_exclusive('xapi-xcpng-lock')
        return ioctx, image
    except ImageBusy or ImageExists as e:
        log.error(
            "%s: xcpng.librbd.rbd_utils.rbd_lock: Failed to acquire exclusive lock: Cluster ID: %s Pool: %s Name: %s"
            % (dbg, cluster.get_fsid(), pool, name))
        image.close()
        ioctx.close()
        raise Exception(e)
Exemple #22
0
    def get_rbd_size(self, rbd_name):
        ''' get size of rbd or rbd snapshot '''
        try:
            image = Image(self.ioctx, rbd_name)
            size = image.size()
            image.close()

            if size is False:
                return False

            self.log.info("%s has image size %s bytes in pool %s." %
                          (str(rbd_name), size, self.pool_name))
            return int(size)
        except Exception as e:
            self.log.error("unable to get size of rbd image (%s). %s" %
                           (rbd_name, e))
            return False
Exemple #23
0
def rbd_utilization(dbg, cluster, pool, name):
    log.debug(
        "%s: xcpng.librbd.rbd_utils.rbd_utilization: Cluster ID: %s Pool: %s Name: %s"
        % (dbg, cluster.get_fsid(), pool, name))
    ioctx = cluster.open_ioctx(pool)
    image = Image(ioctx, name)

    try:
        image_stat = image.stat()
        return image_stat['num_objs'] * image_stat['obj_size']
    except Exception as e:
        log.error(
            "%s: xcpng.librbd.rbd_utils.rbd_utilisation: Failed to get an image utilization: Cluster ID: %s Pool %s Name: %s"
            % (dbg, cluster.get_fsid(), pool, name))
        raise Exception(e)
    finally:
        ioctx.close()
Exemple #24
0
    def test_unprotect_with_children(self):
        global features
        # can't remove a snapshot that has dependent clones
        assert_raises(ImageBusy, self.image.remove_snap, 'snap1')

        # validate parent info of clone created by TestClone.setUp
        (pool, image, snap) = self.clone.parent_info()
        eq(pool, pool_name)
        eq(image, image_name)
        eq(snap, 'snap1')

        # create a new pool...
        pool_name2 = get_temp_pool_name()
        rados.create_pool(pool_name2)
        other_ioctx = rados.open_ioctx(pool_name2)

        # ...with a clone of the same parent
        other_clone_name = get_temp_image_name()
        self.rbd.clone(ioctx, image_name, 'snap1', other_ioctx,
                       other_clone_name, features)
        self.other_clone = Image(other_ioctx, other_clone_name)
        # validate its parent info
        (pool, image, snap) = self.other_clone.parent_info()
        eq(pool, pool_name)
        eq(image, image_name)
        eq(snap, 'snap1')

        # can't unprotect snap with children
        assert_raises(ImageBusy, self.image.unprotect_snap, 'snap1')

        # 2 children, check that cannot remove the parent snap
        assert_raises(ImageBusy, self.image.remove_snap, 'snap1')

        # close and remove other pool's clone
        self.other_clone.close()
        self.rbd.remove(other_ioctx, other_clone_name)

        # check that we cannot yet remove the parent snap
        assert_raises(ImageBusy, self.image.remove_snap, 'snap1')

        other_ioctx.close()
        rados.delete_pool(pool_name2)
    def get_snap_info_list(self, rbd_name):
        try:
            image = Image(self.ioctx, rbd_name)
            snaps = image.list_snaps()
            snap_list = []
            for snap in snaps:
                snap_list.append({
                    'id': snap['id'],
                    'size': snap['size'],
                    'name': snap['name']
                })

            self.log.debug(
                "Snapshot list of RBD '%s/%s' in Ceph cluster:" %
                (rbd_name, self.pool_name), snap_list)
            sorted_snap_list = sorted(snap_list, key=lambda k: k['id'])
            return sorted_snap_list
        except Exception as e:
            self.log.error("Fail to get snapshot. %s" % e)
            return False
        finally:
            image.close()
Exemple #26
0
 def _test_copy(self, features=None, order=None, stripe_unit=None,
                stripe_count=None):
     global ioctx
     data = rand_data(256)
     self.image.write(data, 256)
     image_name = get_temp_image_name()
     if features is None:
         self.image.copy(ioctx, image_name)
     elif order is None:
         self.image.copy(ioctx, image_name, features)
     elif stripe_unit is None:
         self.image.copy(ioctx, image_name, features, order)
     elif stripe_count is None:
         self.image.copy(ioctx, image_name, features, order, stripe_unit)
     else:
         self.image.copy(ioctx, image_name, features, order, stripe_unit,
                         stripe_count)
     assert_raises(ImageExists, self.image.copy, ioctx, image_name)
     copy = Image(ioctx, image_name)
     copy_data = copy.read(256, 256)
     copy.close()
     self.rbd.remove(ioctx, image_name)
     eq(data, copy_data)
Exemple #27
0
def rbd_clone(dbg, cluster, parent_pool, parent, snapshot, clone_pool, clone):
    log.debug(
        "%s: xcpng.librbd.rbd_utils.rbd_clone: Cluster ID: %s Parent Pool: %s Parent: %s Snapshot: %s Clone Pool: %s Clone: %s"
        % (dbg, cluster.get_fsid(), parent_pool, parent, snapshot, clone_pool,
           clone))
    p_ioctx = cluster.open_ioctx(parent_pool)
    p_image = Image(p_ioctx, parent)
    c_ioctx = cluster.open_ioctx(clone_pool)
    rbd_inst = RBD()

    try:
        if not p_image.is_protected_snap(snapshot):
            p_image.protect_snap(snapshot)
        rbd_inst.clone(p_ioctx, parent, snapshot, c_ioctx, clone)
    except Exception as e:
        log.error(
            "%s: xcpng.librbd.rbd_utils.rbd_clone: Failed to make a clone: Cluster ID: %s Parent Pool: %s Parent: %s Snapshot: %s Clone Pool: %s Clone: %s"
            % (dbg, cluster.get_fsid(), parent_pool, parent, snapshot,
               clone_pool, clone))
        raise Exception(e)
    finally:
        p_ioctx.close()
        c_ioctx.close()
Exemple #28
0
    def execute(self, worker_name=None):
        try:
            '''
            from_snap_str = ''
            if self.from_snap is not None:
                from_snap_str = "--from-snap %s" % self.from_snap

            cmd = "rbd diff --cluster %s -p %s %s %s" % (self.cluster_name,
                                                          self.pool_name,
                                                          from_snap_str,
                                                          self.rbd_name)
            cmd = "%s | awk '{ SUM += $2} END { print SUM }'" % cmd
            size = self._exec_cmd(cmd)

            '''
            self.worker_name = worker_name

            self.start_timestamp = time.time()

            cluster = rados.Rados(conffile=self.conffile)
            cluster.connect()
            ioctx = cluster.open_ioctx(self.pool_name)
            image = Image(self.ioctx, rbd_name)

            size = image.size()

            image.diff_iterate(0, size, self.from_snap, self._iterate_cb)

            # just set the cmd as function all
            self.cmd = "image.diff_iterate(0, %s, %s, self._iterate_cb)" % (size, self.from_snap)

            self.elapsed_time = self._get_elapsed_time_()
            self._verify_result(result)

        except Exception as e:
            print("error: %s" %e)
            return False
Exemple #29
0
    def test_unprotect_with_children(self):
        global features
        # can't remove a snapshot that has dependent clones
        assert_raises(ImageBusy, self.image.remove_snap, 'snap1')

        # validate parent info of clone created by TestClone.setUp
        (pool, image, snap) = self.clone.parent_info()
        eq(pool, 'rbd')
        eq(image, IMG_NAME)
        eq(snap, 'snap1')

        # create a new pool...
        rados.create_pool('rbd2')
        other_ioctx = rados.open_ioctx('rbd2')

        # ...with a clone of the same parent
        self.rbd.clone(ioctx, IMG_NAME, 'snap1', other_ioctx, 'other_clone',
                       features)
        self.other_clone = Image(other_ioctx, 'other_clone')
        # validate its parent info
        (pool, image, snap) = self.other_clone.parent_info()
        eq(pool, 'rbd')
        eq(image, IMG_NAME)
        eq(snap, 'snap1')

        # 2 children, check that cannot remove the parent snap
        assert_raises(ImageBusy, self.image.remove_snap, 'snap1')

        # close and remove other pool's clone
        self.other_clone.close()
        self.rbd.remove(other_ioctx, 'other_clone')

        # check that we cannot yet remove the parent snap
        assert_raises(ImageBusy, self.image.remove_snap, 'snap1')

        other_ioctx.close()
        rados.delete_pool('rbd2')
Exemple #30
0
    def test_list_children(self):
        global ioctx
        global features
        self.image.set_snap('snap1')
        self.check_children([('rbd', 'clone')])
        self.clone.close()
        self.rbd.remove(ioctx, 'clone')
        eq(self.image.list_children(), [])

        expected_children = []
        for i in xrange(10):
            self.rbd.clone(ioctx, IMG_NAME, 'snap1', ioctx, 'clone%d' % i, features)
            expected_children.append(('rbd', 'clone%d' % i))
            self.check_children(expected_children)

        for i in xrange(10):
            self.rbd.remove(ioctx, 'clone%d' % i)
            expected_children.pop(0)
            self.check_children(expected_children)

        eq(self.image.list_children(), [])
        self.rbd.clone(ioctx, IMG_NAME, 'snap1', ioctx, 'clone', features)
        self.check_children([('rbd', 'clone')])
        self.clone = Image(ioctx, 'clone')