From: Pere Diaz Bou Date: Mon, 12 Jun 2023 09:16:33 +0000 (+0200) Subject: mgr/dashboard: n/a entries behind primary snapshot mode X-Git-Tag: v19.0.0~606^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6066e37ad3c6bc43c3e5e4313a89265007e7d0d8;p=ceph.git mgr/dashboard: n/a entries behind primary snapshot mode Fixes: https://tracker.ceph.com/issues/62576 Signed-off-by: Pere Diaz Bou --- diff --git a/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py b/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py index 5e082b701102e..af30e8415eb79 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py +++ b/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py @@ -238,6 +238,17 @@ class ReplayingData(NamedTuple): entries_behind_primary: Optional[int] = None +def _get_mirror_mode(ioctx, image_name): + with rbd.Image(ioctx, image_name) as img: + mirror_mode = img.mirror_image_get_mode() + mirror_mode_str = 'Disabled' + if mirror_mode == rbd.RBD_MIRROR_IMAGE_MODE_JOURNAL: + mirror_mode_str = 'journal' + elif mirror_mode == rbd.RBD_MIRROR_IMAGE_MODE_SNAPSHOT: + mirror_mode_str = 'snapshot' + return mirror_mode_str + + @ViewCache() @no_type_check def _get_pool_datum(pool_name): @@ -300,7 +311,8 @@ def _get_pool_datum(pool_name): data['mirror_images'] = sorted([ dict({ 'name': image['name'], - 'description': image['description'] + 'description': image['description'], + 'mirror_mode': _get_mirror_mode(ioctx, image['name']) }, **mirror_state['down' if not image['up'] else image['state']]) for image in mirror_image_status ], key=lambda k: k['name']) @@ -363,7 +375,8 @@ def _get_content_data(): # pylint: disable=R0914 'pool_name': pool_name, 'name': mirror_image['name'], 'state_color': mirror_image['state_color'], - 'state': mirror_image['state'] + 'state': mirror_image['state'], + 'mirror_mode': mirror_image['mirror_mode'] } if mirror_image['health'] == 'ok': diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.html index 1a92315101170..45056ab357036 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.html @@ -64,3 +64,13 @@ [showValue]="true"> + + + + {{ value }} + + - + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts index babd46542e533..c022f21c30e28 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts @@ -17,6 +17,8 @@ export class ImageListComponent implements OnInit, OnDestroy { syncTmpl: TemplateRef; @ViewChild('progressTmpl', { static: true }) progressTmpl: TemplateRef; + @ViewChild('entriesBehindPrimaryTpl', { static: true }) + entriesBehindPrimaryTpl: TemplateRef; subs: Subscription; @@ -66,7 +68,12 @@ export class ImageListComponent implements OnInit, OnDestroy { flexGrow: 2 }, { prop: 'bytes_per_second', name: $localize`Bytes per second`, flexGrow: 2 }, - { prop: 'entries_behind_primary', name: $localize`Entries behind primary`, flexGrow: 2 } + { + prop: 'entries_behind_primary', + name: $localize`Entries behind primary`, + cellTemplate: this.entriesBehindPrimaryTpl, + flexGrow: 2 + } ]; this.image_ready.columns = [