Skip to content

mgr/dashboard: work with v1 RBD images#35007

Merged
LenzGr merged 1 commit intoceph:masterfrom
rhcs-dashboard:fix-36354-master
Jun 10, 2020
Merged

mgr/dashboard: work with v1 RBD images#35007
LenzGr merged 1 commit intoceph:masterfrom
rhcs-dashboard:fix-36354-master

Conversation

@epuertat
Copy link
Copy Markdown
Member

@epuertat epuertat commented May 11, 2020

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)
  • 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.

After: #35025
Fixes: https://tracker.ceph.com/issues/36354
Signed-off-by: Ernesto Puerta epuertat@redhat.com

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard backend
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@epuertat epuertat requested a review from a team as a code owner May 11, 2020 18:57
@epuertat epuertat self-assigned this May 11, 2020
@epuertat epuertat added the rbd label May 11, 2020
@epuertat epuertat changed the title mgr/dashboard: work with RBD images v1 mgr/dashboard: work with v1 RBD images May 11, 2020
@epuertat epuertat requested a review from dillaman May 11, 2020 19:01
Copy link
Copy Markdown

@dillaman dillaman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: you should be able to copy a v1 image (to a v2 image)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the error came from within dashboard implementation. Will check for exceptions there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the hint @trociny. So if @dillaman is going to fix this, I'll re-enable copy (it was kinda-gracefully failing before).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@epuertat I've opened a PR here: #35025

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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That applies for v2 images as well -- ids are only guaranteed to be unique within the same pool + namespace.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, concatenating pool ID and image ID:

  • v1: id: "2.rb.0.104e.6b8b4567"
  • v2: id: "2.104c2fe7ebe3"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to insert the namespace string into the id string for v2 images as well?

Indeed -- good catch.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bk201 ! Done.

@LenzGr LenzGr requested a review from trociny May 12, 2020 09:05
@epuertat epuertat force-pushed the fix-36354-master branch 4 times, most recently from b532a51 to 7dc33b4 Compare June 1, 2020 16:50
@epuertat
Copy link
Copy Markdown
Member Author

epuertat commented Jun 1, 2020

@dillaman @trociny could you please check that the following operations with v1 and v2 & outcomes match your expectations from rbd CLI? Thanks!

Action v1 v2
Create
Only from CLI
🆗
Edit 🆗
Flags disabled
🆗
Copy 🆗
Migrates to v2
🆗
Flatten
Disabled
🆗
Delete 🆗 🆗
Move to trash
Disabled
🆗
Snapshot > Create 🆗 🆗
Snapshot > Rename 🆗 🆗
Snapshot > Delete 🆗 🆗
Snapshot > Protect
Failure (similar to v2 without flags set)
🆗
Snapshot > Copy 🆗
Migrates a v1 snapshot to a v2 image
🆗
Snapshot > Rollback 🆗 🆗

Edit v1

All flags are disabled.
image

Copy link
Copy Markdown
Contributor

@trociny trociny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown

@dillaman dillaman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm -- thx!

@epuertat epuertat force-pushed the fix-36354-master branch from 7dc33b4 to 1b71888 Compare June 1, 2020 18:07
@bk201
Copy link
Copy Markdown
Contributor

bk201 commented Jun 2, 2020

jenkins test dashboard backend

@bk201 bk201 requested a review from a team June 2, 2020 04:45
@epuertat
Copy link
Copy Markdown
Member Author

epuertat commented Jun 2, 2020

jenkins test dashboard backend

@epuertat
Copy link
Copy Markdown
Member Author

epuertat commented Jun 2, 2020

jenkins test dashboard backend

Seems the trigger-phrase is no longer working. @djgalloway could this behaviour be related to ceph/ceph-build#1575?

@djgalloway
Copy link
Copy Markdown
Contributor

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

@epuertat epuertat force-pushed the fix-36354-master branch from 1b71888 to 9dc154b Compare June 2, 2020 11:59
@epuertat
Copy link
Copy Markdown
Member Author

epuertat commented Jun 2, 2020

jenkins test dashboard backend

@epuertat epuertat force-pushed the fix-36354-master branch from 9dc154b to 716fc0e Compare June 2, 2020 19:24
@epuertat epuertat requested a review from a team June 2, 2020 19:24
@epuertat epuertat force-pushed the fix-36354-master branch from 716fc0e to 2444cb5 Compare June 2, 2020 19:36
@epuertat
Copy link
Copy Markdown
Member Author

epuertat commented Jun 2, 2020

API tests caught the following error: 🎉

  • RBD Trash ops don't use the regular image_spec (pool + namespace + image_name) but image_id_spec (pool + namespace + image_id).

Fixed now.

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>
@callithea
Copy link
Copy Markdown
Member

callithea commented Jun 8, 2020

Copy link
Copy Markdown
Member

@callithea callithea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@LenzGr LenzGr merged commit 11ddc9c into ceph:master Jun 10, 2020
@epuertat epuertat deleted the fix-36354-master branch June 22, 2020 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

8 participants