mgr/dashboard: work with v1 RBD images#35007
Conversation
dillaman
left a comment
There was a problem hiding this comment.
The other thing to potentially look-out for is that you (1) shouldn't be able to protect snapshots if the image is v1 (or doesn't have the LAYERING feature), (2) nor clone.
| !selection.hasSingleSelection || selection.first().cdExecuting, | ||
| !selection.hasSingleSelection || | ||
| selection.first().cdExecuting || | ||
| selection.first().image_format === RBDImageFormat.V1, |
There was a problem hiding this comment.
Nit: you should be able to copy a v1 image (to a v2 image)
There was a problem hiding this comment.
Then the error came from within dashboard implementation. Will check for exceptions there.
There was a problem hiding this comment.
I think it fails because it tries to create the destination image as v1 format: if the format is not explicitly specified the source image format is used [1].
@dillman I suppose we should change this to use v2 format if it is not specified via image options?
Another problem with copy I see here is that although we allow to specify the destination image format via image options in C/C++ API, we do not provide such possibility neither for python nor for CLI. So, right now the dashboard can't force the destination image v2 format in any way. Do we want to improve this or it is not worth doing taking the fromat v1 is depricated? (I vote for the later)
[1] https://github.com/ceph/ceph/blob/master/src/librbd/internal.cc#L1126
There was a problem hiding this comment.
Ouch -- that's no good. I am going to submit another commit to fix that copy defaulting to the source format since we really should never be creating v1 images any more.
| stat['name'] = image_name | ||
| stat['id'] = img.id() | ||
| stat['id'], stat['image_format'] = (img.id(), 2) if \ | ||
| not img.old_format() else (stat['block_name_prefix'], 1) |
There was a problem hiding this comment.
Nit: Technically, v1 images don't have an id. So long as this isn't being used as a key for something and is mearly for display purposes, I'd say just drop the rb. prefix from the v1 block name prefix.
There was a problem hiding this comment.
So, cannot that be expected to be a unique index? The Dashboard front-end table needs a unique id to work. If not the block_name_prefix, what else could do the trick?
There was a problem hiding this comment.
It's guaranteed to be unique per pool -- it just is meaningless to the user. If you just need something for a unique index for internal structures, definitely can use it.
There was a problem hiding this comment.
Great, thanks! For the ID v1 I'll concat pool_id and block_name_prefix then (Dashboard RBD images provides an aggregate view across pools, so IDs need to be globally unique).
There was a problem hiding this comment.
That applies for v2 images as well -- ids are only guaranteed to be unique within the same pool + namespace.
There was a problem hiding this comment.
Done, concatenating pool ID and image ID:
- v1:
id: "2.rb.0.104e.6b8b4567" - v2:
id: "2.104c2fe7ebe3"
There was a problem hiding this comment.
That applies for v2 images as well -- ids are only guaranteed to be unique within the same pool + namespace.
Do we want to insert the namespace string into the id string for v2 images as well?
There was a problem hiding this comment.
Do we want to insert the namespace string into the id string for v2 images as well?
Indeed -- good catch.
b532a51 to
7dc33b4
Compare
|
@dillaman @trociny could you please check that the following operations with v1 and v2 & outcomes match your expectations from rbd CLI? Thanks!
Edit v1 |
7dc33b4 to
1b71888
Compare
|
jenkins test dashboard backend |
|
jenkins test dashboard backend |
Seems the trigger-phrase is no longer working. @djgalloway could this behaviour be related to ceph/ceph-build#1575? |
ceph/ceph-build#1580 should fix this |
1b71888 to
9dc154b
Compare
|
jenkins test dashboard backend |
9dc154b to
716fc0e
Compare
716fc0e to
2444cb5
Compare
|
API tests caught the following error: 🎉
Fixed now. |
2444cb5 to
783b51a
Compare
Add support for RBD Image Format v1: - This format lacks ID field, required for dashboard. Instead, RBD image `block_name_prefix` is used as unique ID (together with pool id and namespace) - Additionally, `image_format` is now exposed. - In the front-end side: - Copy action on a v1 image will cause the image to be copied to v2 format. - List doesn't allow Move to Trash on v1 images, - Details section now shows `image_format` for images, - Edit Form disables flags not supported for v1 (`deep-flatten`, `layering`, `exclusive-lock`). - Protect does not work on v1 images or v2 images created from v1 ones. Fixes: https://tracker.ceph.com/issues/36354 Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
783b51a to
119851e
Compare

Add support for RBD Image Format v1:
block_name_prefixis used as unique ID (together with pool id)image_formatis now exposed.image_formatfor images,deep-flatten,layering,exclusive-lock).After: #35025
Fixes: https://tracker.ceph.com/issues/36354
Signed-off-by: Ernesto Puerta epuertat@redhat.com
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard backendjenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume tox