Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr/dashboard: add rbd primary info #46479

Merged
merged 1 commit into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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