return total_used_size, snap_map
@classmethod
- def _rbd_image(cls, ioctx, pool_name, namespace, image_name):
+ def _rbd_image(cls, ioctx, pool_name, namespace, image_name): # pylint: disable=R0912
with rbd.Image(ioctx, image_name) as img:
-
stat = img.stat()
+ mirror_mode = img.mirror_image_get_mode()
+ if mirror_mode == rbd.RBD_MIRROR_IMAGE_MODE_JOURNAL:
+ stat['mirror_mode'] = 'journal'
+ elif mirror_mode == rbd.RBD_MIRROR_IMAGE_MODE_SNAPSHOT:
+ stat['mirror_mode'] = 'snapshot'
+ schedule_status = json.loads(_rbd_support_remote(
+ 'mirror_snapshot_schedule_status')[1])
+ for scheduled_image in schedule_status['scheduled_images']:
+ if scheduled_image['image'] == get_image_spec(pool_name, namespace, image_name):
+ stat['schedule_info'] = scheduled_image
+ else:
+ stat['mirror_mode'] = 'unknown'
+
stat['name'] = image_name
+
+ mirror_info = img.mirror_image_get_info()
+ stat['primary'] = None
+ if mirror_info['state'] == rbd.RBD_MIRROR_IMAGE_ENABLED:
+ stat['primary'] = mirror_info['primary']
+
if img.old_format():
stat['unique_id'] = get_image_spec(pool_name, namespace, stat['block_name_prefix'])
stat['id'] = stat['unique_id']