Skip to content

Commit

Permalink
Merge pull request #46479 from rhcs-dashboard/rbd-mirroring-list-primary
Browse files Browse the repository at this point in the history
mgr/dashboard: add rbd primary info

Reviewed-by: Sarthak Gupta <sarthak.dev.0702@gmail.com>
Reviewed-by: Ernesto Puerta <epuertat@redhat.com>
  • Loading branch information
pereman2 committed Jun 7, 2022
2 parents d8e0903 + 578ee21 commit e3062db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions qa/tasks/mgr/dashboard/test_rbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ def _validate_image(self, img, **kwargs):
"name": "img1",
"pool_name": "rbd",
"features": 61,
"primary": true,
"features_name": ["deep-flatten", "exclusive-lock", "fast-diff", "layering",
"object-map"]
}
Expand All @@ -227,6 +228,7 @@ def _validate_image(self, img, **kwargs):
'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),
Expand Down
6 changes: 6 additions & 0 deletions src/pybind/mgr/dashboard/services/rbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ def _rbd_image(cls, ioctx, pool_name, namespace, image_name):

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']
Expand Down

0 comments on commit e3062db

Please sign in to comment.