]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #46263 from rhcs-dashboard/rbd-mirroring-snapshot
authorErnesto Puerta <37327689+epuertat@users.noreply.github.com>
Tue, 7 Jun 2022 14:25:57 +0000 (16:25 +0200)
committerGitHub <noreply@github.com>
Tue, 7 Jun 2022 14:25:57 +0000 (16:25 +0200)
mgr/dashboard: rbd mirroring snapshot support

Reviewed-by: Aashish Sharma <aasharma@redhat.com>
Reviewed-by: Avan Thakkar <athakkar@redhat.com>
Reviewed-by: Ernesto Puerta <epuertat@redhat.com>
Reviewed-by: Deepika Upadhyay <dupadhya@redhat.com>
Reviewed-by: Nizamudeen A <nia@redhat.com>
1  2 
qa/tasks/mgr/dashboard/test_rbd.py
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.html
src/pybind/mgr/dashboard/services/rbd.py

Simple merge
index 22e64eecffa5df5c4f6c2e106f77d83acbce9f7c,07b4db9e6a427aba2db441871cd8c287d1775eeb..59b413dea8949ec8b5223a68c6f62ac4377a8f8d
@@@ -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']