]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: n/a entries behind primary snapshot mode 52005/head
authorPere Diaz Bou <pere-altea@hotmail.com>
Mon, 12 Jun 2023 09:16:33 +0000 (11:16 +0200)
committerPere Diaz Bou <pere-altea@hotmail.com>
Fri, 25 Aug 2023 09:28:54 +0000 (11:28 +0200)
Fixes: https://tracker.ceph.com/issues/62576
Signed-off-by: Pere Diaz Bou <pere-altea@hotmail.com>
src/pybind/mgr/dashboard/controllers/rbd_mirroring.py
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts

index 5e082b701102e2a38973a68ad82bdb72bc988c7c..af30e8415eb795e4d13d3d950af3fcfc4355b9c5 100644 (file)
@@ -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':
index 1a92315101170ff1648fd690738a3611c6671fcb..45056ab357036d3ed851ed57205ee1cdeddc3399 100644 (file)
                      [showValue]="true"></ngb-progressbar>
   </div>
 </ng-template>
+
+<ng-template #entriesBehindPrimaryTpl
+             let-row="row"
+             let-value="value">
+  <span *ngIf="row.mirror_mode === 'journal'">
+    {{ value }}
+  </span>
+  <span *ngIf="row.mirror_mode === 'snapshot'"
+        ngbTooltip="Not available with mirroring snapshot mode">-</span>
+</ng-template>
index babd46542e533c2f24169724e73d767b4321df70..c022f21c30e286908370bff0ef2b862ccdbb0576 100644 (file)
@@ -17,6 +17,8 @@ export class ImageListComponent implements OnInit, OnDestroy {
   syncTmpl: TemplateRef<any>;
   @ViewChild('progressTmpl', { static: true })
   progressTmpl: TemplateRef<any>;
+  @ViewChild('entriesBehindPrimaryTpl', { static: true })
+  entriesBehindPrimaryTpl: TemplateRef<any>;
 
   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 = [