From: Ernesto Puerta <37327689+epuertat@users.noreply.github.com> Date: Tue, 7 Jun 2022 14:25:57 +0000 (+0200) Subject: Merge pull request #46263 from rhcs-dashboard/rbd-mirroring-snapshot X-Git-Tag: v18.0.0~755 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=65acb3e124566cdcb12810a5127d25f30ecd26d9;p=ceph.git Merge pull request #46263 from rhcs-dashboard/rbd-mirroring-snapshot mgr/dashboard: rbd mirroring snapshot support Reviewed-by: Aashish Sharma Reviewed-by: Avan Thakkar Reviewed-by: Ernesto Puerta Reviewed-by: Deepika Upadhyay Reviewed-by: Nizamudeen A --- 65acb3e124566cdcb12810a5127d25f30ecd26d9 diff --cc src/pybind/mgr/dashboard/services/rbd.py index 22e64eecffa5,07b4db9e6a42..59b413dea894 --- a/src/pybind/mgr/dashboard/services/rbd.py +++ b/src/pybind/mgr/dashboard/services/rbd.py @@@ -245,17 -262,23 +262,29 @@@ class RbdService(object) 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']