RbdConfiguration(pool_ioctx=ioctx, image_name=image_name).set_configuration(
configuration)
+ if metadata:
+ RbdImageMetadataService(image).set_metadata(metadata)
- mirror_image_info = image.mirror_image_get_info()
- if enable_mirror and mirror_image_info['state'] == rbd.RBD_MIRROR_IMAGE_DISABLED:
- RbdMirroringService.enable_image(
- image_name, pool_name, namespace,
- MIRROR_IMAGE_MODE[mirror_mode])
- elif (enable_mirror is False
- and mirror_image_info['state'] == rbd.RBD_MIRROR_IMAGE_ENABLED):
- RbdMirroringService.disable_image(
- image_name, pool_name, namespace)
-
if primary and not mirror_image_info['primary']:
RbdMirroringService.promote_image(
image_name, pool_name, namespace)