From: Pere Diaz Bou Date: Mon, 30 May 2022 14:10:11 +0000 (+0200) Subject: mgr/dashboard: move replaying images to Syncing tab X-Git-Tag: v17.2.4~224^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d225328363abc22f1f30f1a740e4d83faa0dfb8c;p=ceph.git mgr/dashboard: move replaying images to Syncing tab Images with 'Replaying' state will be displayed in Syncing tab. syncTmpl removed as it was unnecessary if sate is provided from the backend. Replaying images in contrast of Syncing images don't have a progress percentage, nevertheless, we have an approximation of how much time left there is until the image is fully synced. Therefore, we can use seconds_until_synced to represent the progress. 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 f5bda8c8926..5a434fbd570 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py +++ b/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py @@ -228,15 +228,17 @@ def _get_pool_datum(pool_name): 'state': 'Error' }, rbd.MIRROR_IMAGE_STATUS_STATE_SYNCING: { - 'health': 'syncing' + 'health': 'syncing', + 'state_color': 'success', + 'state': 'Syncing' }, rbd.MIRROR_IMAGE_STATUS_STATE_STARTING_REPLAY: { - 'health': 'ok', + 'health': 'syncing', 'state_color': 'success', 'state': 'Starting' }, rbd.MIRROR_IMAGE_STATUS_STATE_REPLAYING: { - 'health': 'ok', + 'health': 'syncing', 'state_color': 'success', 'state': 'Replaying' }, @@ -296,26 +298,36 @@ def _get_content_data(): # pylint: disable=R0914 for mirror_image in mirror_images: image = { 'pool_name': pool_name, - 'name': mirror_image['name'] + 'name': mirror_image['name'], + 'state_color': mirror_image['state_color'], + 'state': mirror_image['state'] } if mirror_image['health'] == 'ok': image.update({ - 'state_color': mirror_image['state_color'], - 'state': mirror_image['state'], 'description': mirror_image['description'] }) image_ready.append(image) elif mirror_image['health'] == 'syncing': - p = re.compile("bootstrapping, IMAGE_COPY/COPY_OBJECT (.*)%") - image.update({ - 'progress': (p.findall(mirror_image['description']) or [0])[0] - }) + if mirror_image['state'] == 'Replaying': + p = re.compile("replaying, ({.*})") + replaying_data = p.findall(mirror_image['description']) + assert len(replaying_data) == 1 + replaying_data = json.loads(replaying_data[0]) + seconds_until_synced = 0 + if 'seconds_until_synced' in replaying_data: + seconds_until_synced = replaying_data['seconds_until_synced'] + image.update({ + 'seconds_until_synced': seconds_until_synced + }) + else: + p = re.compile("bootstrapping, IMAGE_COPY/COPY_OBJECT (.*)%") + image.update({ + 'progress': (p.findall(mirror_image['description']) or [0])[0] + }) image_syncing.append(image) else: image.update({ - 'state_color': mirror_image['state_color'], - 'state': mirror_image['state'], 'description': mirror_image['description'] }) image_error.append(image) 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 25f1442f887..a052f43c9a5 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 @@ -4,7 +4,7 @@ cdStatefulTab="image-list">
  • Issues + i18n>Issues ({{ image_error.data.length }})
  • Syncing + i18n>Syncing ({{ image_syncing.data.length }})
  • Ready + i18n>Ready ({{ image_ready.data.length }}) {{ value }} - - Syncing - - - + + synced + + + {{row.seconds_until_synced | duration }} until synced + + + 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 015031ebeeb..c7f6e91883e 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 @@ -62,7 +62,7 @@ export class ImageListComponent implements OnInit, OnDestroy { { prop: 'state', name: $localize`State`, - cellTemplate: this.syncTmpl, + cellTemplate: this.stateTmpl, flexGrow: 1 } ];