]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: add rbd primary info
authorPere Diaz Bou <pdiazbou@redhat.com>
Wed, 1 Jun 2022 10:44:35 +0000 (12:44 +0200)
committerPedro Gonzalez Gomez <pegonzal@redhat.com>
Thu, 18 Aug 2022 08:34:21 +0000 (10:34 +0200)
Signed-off-by: Pere Diaz Bou <pdiazbou@redhat.com>
Resolves: rhbz#2115243

qa/tasks/mgr/dashboard/test_rbd.py
src/pybind/mgr/dashboard/services/rbd.py

index 4e0367fd5be77b299394faa66a40e1a8d7f220f0..63e7ac094ef0d4a231e60c2ade1f745217b6ecf4 100644 (file)
@@ -212,6 +212,7 @@ class RbdTest(DashboardTestCase):
             "name": "img1",
             "pool_name": "rbd",
             "features": 61,
+            "primary": true,
             "features_name": ["deep-flatten", "exclusive-lock", "fast-diff", "layering",
                               "object-map"]
         }
@@ -228,6 +229,7 @@ class RbdTest(DashboardTestCase):
             'image_format': JLeaf(int),
             'pool_name': JLeaf(str),
             'namespace': JLeaf(str, none=True),
+            'primary': JLeaf(bool, none=True),
             'features': JLeaf(int),
             'features_name': JList(JLeaf(str)),
             'stripe_count': JLeaf(int, none=True),
index f9203b2418eb6fb19272e85f4db378e6c799fa72..922da3fbd91060fee617b597c2bfdc43ba3a4552 100644 (file)
@@ -279,6 +279,12 @@ class RbdService(object):
                 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']