]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: add rbd primary info 46479/head
authorPere Diaz Bou <pdiazbou@redhat.com>
Wed, 1 Jun 2022 10:44:35 +0000 (12:44 +0200)
committerPere Diaz Bou <pdiazbou@redhat.com>
Mon, 6 Jun 2022 04:43:07 +0000 (06:43 +0200)
Signed-off-by: Pere Diaz Bou <pdiazbou@redhat.com>
qa/tasks/mgr/dashboard/test_rbd.py
src/pybind/mgr/dashboard/services/rbd.py

index b8df472a69254ddeef99466e819d98b5227ab934..1f98a93e05805ed1021880fafe7835c3b285db7a 100644 (file)
@@ -211,6 +211,7 @@ class RbdTest(DashboardTestCase):
             "name": "img1",
             "pool_name": "rbd",
             "features": 61,
+            "primary": true,
             "features_name": ["deep-flatten", "exclusive-lock", "fast-diff", "layering",
                               "object-map"]
         }
@@ -227,6 +228,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 2c255a4fcb6e515f377ca325eda3983abe67eb8d..22e64eecffa5df5c4f6c2e106f77d83acbce9f7c 100644 (file)
@@ -250,6 +250,12 @@ class RbdService(object):
 
             stat = img.stat()
             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']