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: v16.2.11~468^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4d4505dfaca135ca1cf80e6fb8ba93337b3df3ec;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 a472fbd49e49..df326b5c9500 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py +++ b/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py @@ -220,15 +220,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' }, @@ -288,26 +290,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 25f1442f8875..a052f43c9a59 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 015031ebeebf..c7f6e91883e9 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 } ];