done
rbd mirror snapshot schedule status | grep 'rbd2/ns1/test1'
+ # set a global level mirror image snapshot schedule
rbd mirror snapshot schedule add 1h 00:15
test "$(rbd mirror snapshot schedule ls)" = 'every 1h starting at 00:15:00'
rbd mirror snapshot schedule ls -R | grep 'every 1h starting at 00:15:00'
test "$(rbd mirror snapshot schedule ls)" = 'every 1h starting at 00:15:00'
test "$(rbd mirror snapshot schedule ls -p rbd2/ns1 --image test1)" = 'every 1m'
+ rbd create $RBD_CREATE_ARGS -s 1 rbd2/ns1/img1
+ rbd create $RBD_CREATE_ARGS -s 1 rbd2/ns1/img2
+ rbd group create rbd2/ns1/gp1
+ rbd group image add rbd2/ns1/gp1 rbd2/ns1/img1
+ # enabling snapshot on the group sets the snapshot mirror mode of the
+ # group's member image 'img1'
+ rbd mirror group enable rbd2/ns1/gp1 snapshot
+ rbd mirror image enable rbd2/ns1/img2 snapshot
+ # can't schedule mirror-snapshot on image 'img1' that is part of a group
+ expect_fail rbd mirror snapshot schedule add -p rbd2/ns1 --image img1 1m
+ # global level snapshot schedule does not create a schedule for the image
+ # 'img1' that is part of a group, but creates a schedule for the standalone
+ # image 'img2'
+ for i in `seq 12`; do
+ rbd mirror snapshot schedule status | grep 'rbd2/ns1/img1' || break
+ sleep 10
+ done
+ rbd mirror snapshot schedule status | expect_fail grep 'rbd2/ns1/img1'
+ for i in `seq 12`; do
+ rbd mirror snapshot schedule status | grep 'rbd2/ns1/img2' && break
+ sleep 10
+ done
+ rbd mirror snapshot schedule status | grep 'rbd2/ns1/img2'
+
rbd rm rbd2/ns1/test1
for i in `seq 12`; do
rbd mirror snapshot schedule status | grep 'rbd2/ns1/test1' || break
if mode != rbd.RBD_MIRROR_IMAGE_MODE_SNAPSHOT:
raise rbd.InvalidArgument("Invalid mirror image mode")
+ if image.group()['pool'] != -1:
+ raise ValueError("image {} is part of a group".format(image.get_name()))
+
class ImageSpec(NamedTuple):
pool_id: str
image_name = image_names.get(image_id)
if not image_name:
continue
+ with rbd.Image(ioctx, image_name, read_only=True) as img:
+ if img.group()['pool'] != -1:
+ continue
if namespace:
name = "{}/{}/{}".format(pool_name, namespace,
image_name)