Skip to content

rbd: promote rbd-nbd attach and detach at rbd integrated cli#41279

Merged
idryomov merged 3 commits intoceph:masterfrom
pkalever:promote-attach
May 27, 2021
Merged

rbd: promote rbd-nbd attach and detach at rbd integrated cli#41279
idryomov merged 3 commits intoceph:masterfrom
pkalever:promote-attach

Conversation

@pkalever
Copy link

@pkalever pkalever commented May 11, 2021

Description:

Example:
$ rbd device attach rpool/image --device /dev/nbd0 --device-type nbd --force
$ rbd device detach rpool/image --device-type nbd

for now returning EOPNOTSUPP with krbd, ggate and wnbd

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>

@github-actions github-actions bot added the rbd label May 11, 2021
@pkalever
Copy link
Author

Copy link
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.

I have not looked at details. But in general it LGTM and I am fine with it.

But @idryomov seemed not to like the idea very much, so I am postponing my review until it is clarified.

@trociny
Copy link
Contributor

trociny commented May 11, 2021

@pkalever And you need to update src/test/cli/rbd/help.t. See the jenkins failure.

@pkalever
Copy link
Author

@pkalever And you need to update src/test/cli/rbd/help.t. See the jenkins failure.

Sure @trociny will fix it. Thanks!

Copy link
Contributor

@idryomov idryomov left a comment

Choose a reason for hiding this comment

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

It's not that I don't like the idea -- on the contrary I'm all for a better, unified, more accessible UI. However:

  • the UI should be safe to use and currently there is a glaring hole here. One single-digit typo in the --device argument or an image spec pasted from the wrong clipboard and you get a kernel crash or, much worse, data corruption. Yes, it is already out there in the form of rbd-nbd attach but not as easily accessible.
  • only nbd device type is covered. krbd is never going to support attach/detach, but the remaining two might. It would be nice to cover at least one (perhaps just as a POC), to make sure that the new commands are accommodating enough.

@pkalever
Copy link
Author

  • only nbd device type is covered. krbd is never going to support attach/detach, but the remaining two might. It would be nice to cover at least one (perhaps just as a POC), to make sure that the new commands are accommodating enough.

I don't have a ggate/wnbd setup, I will check on it.

Thanks, @idryomov and @trociny for a quick review.

@wjwithagen
Copy link
Contributor

  • only nbd device type is covered. krbd is never going to support attach/detach, but the remaining two might. It would be nice to cover at least one (perhaps just as a POC), to make sure that the new commands are accommodating enough.

I don't have a ggate/wnbd setup, I will check on it.

Thanks, @idryomov and @trociny for a quick review.

I understand that a POC would be nice/wise, but both ggate and wnbd are on none Linux platforms.
And for ggate I have the feeling that attach/detach is possible, but have not worked on it, and it might take some time to actually implement that. This is however a strong incentive to move forward on this point.

@pkalever
Copy link
Author

  • only nbd device type is covered. krbd is never going to support attach/detach, but the remaining two might. It would be nice to cover at least one (perhaps just as a POC), to make sure that the new commands are accommodating enough.

I don't have a ggate/wnbd setup, I will check on it.
Thanks, @idryomov and @trociny for a quick review.

I understand that a POC would be nice/wise, but both ggate and wnbd are on none Linux platforms.
And for ggate I have the feeling that attach/detach is possible, but have not worked on it, and it might take some time to actually implement that. This is however a strong incentive to move forward on this point.

I thought the implementation of attach/detach exists already with wnbd/ggate and just the rbd CLI integration is missing.
@wjwithagen thanks for ringing the bell, I just checked the code and they are missing.

@pkalever pkalever requested review from idryomov and trociny May 12, 2021 08:46
@pkalever
Copy link
Author

The V3 addresses all the comments from @idryomov and @trociny, except that promotion of attach/detach at rbd CLI is added only for nbd, as the backend attach/detach support is missing for ggate/wnbd at the moment.

IMHO, we can promote attach/detach for ggate/wnbd once the backend support is Inplace.

Thanks!

@pkalever pkalever requested a review from idryomov May 12, 2021 11:08
@lxbsz
Copy link
Member

lxbsz commented May 12, 2021

jenkins test make check

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

@pkalever pkalever requested review from lxbsz and trociny May 17, 2021 09:48
Copy link
Member

@lxbsz lxbsz left a comment

Choose a reason for hiding this comment

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

LGTM.

@pkalever
Copy link
Author

@idryomov @trociny This PR is ready for merge(IMO), can you please help to land this in master.

Thanks!

Copy link
Contributor

@idryomov idryomov left a comment

Choose a reason for hiding this comment

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

I still have a problem with rbd attach being unsafe.

Let's add a --force option. For now, until the kernel support for backend_id is merged, it would basically be required and in order to attach the user would need to say rbd device attach --device /dev/nbd0 --force .... Later, on newer kernels, the user would either provide --device-cookie or --force.

How does that sound?

@idryomov
Copy link
Contributor

The man page (doc/man/8/rbd.rst) needs to be updated.

@pkalever
Copy link
Author

I still have a problem with rbd attach being unsafe.

Let's add a --force option. For now, until the kernel support for backend_id is merged, it would basically be required and in order to attach the user would need to say rbd device attach --device /dev/nbd0 --force .... Later, on newer kernels, the user would either provide --device-cookie or --force.

How does that sound?

Perfect!

The man page (doc/man/8/rbd.rst) needs to be updated.

Sure, thanks!

@pkalever
Copy link
Author

@idryomov I have not touched about the latest --force option related changes at rbd-nbd.cc intentionally, because mandating --force with rbd-nbd CLI might break its existing users.

@pkalever
Copy link
Author

@idryomov could you please take a look?

Thanks!

@pkalever pkalever requested a review from lxbsz May 25, 2021 07:02
specific options (opt1,opt2=val,...).

:command:`device detach` [-t | --device-type *device-type*] [-o | --options *device-options*] *image-spec* | *snap-spec* | *device-path*
Detach the block device that was mapped/attached via supported device type.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Detach the block device that was mapped/attached via supported device type.
Detach the block device that was mapped or attached (currently only `nbd`
on Linux). This operation is unsafe and should not be normally used.

Copy link
Author

Choose a reason for hiding this comment

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

Why is detach unsafe BTW ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Unless I'm missing something, it just sends SIGTERM to rbd-nbd without regard to in-flight I/O. Now, rbd-nbd catches SIGTERM and exits the polling loop so it is better than SIGKILL, but it looks like all in-flight user data is going to get lost unless you reattach in time.

@idryomov
Copy link
Contributor

"rbd: allow nbd attach on --force only" and "man: updated rbd man page with attach/detach options" can be folded into "rbd: promote rbd-nbd attach and detach at rbd integrated cli" (updating the example in the commit message for --force).

@idryomov
Copy link
Contributor

Now that 4f6370b is merged, need to update "test detach/attach" section of rbd-nbd.sh to use the new commands. Should be trivial, but while at it please add a test case for rbd device attach without --force.

@pkalever pkalever requested review from idryomov and lxbsz May 25, 2021 13:13
@pkalever
Copy link
Author

@idryomov everything incorporated.

I had just changed this part.

This operation is unsafe and should not be normally used.

This operation is unsafe and should be used very carefully.

Thanks!

Prasanna Kumar Kalever added 2 commits May 26, 2021 10:17
Example:
$ rbd device attach rbd-pool/image --device /dev/nbd0 --device-type nbd --force
$ rbd device detach rpool/image --device-type nbd

for now returning EOPNOTSUPP with krbd, ggate and wnbd

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
@pkalever pkalever requested a review from idryomov May 26, 2021 04:54
@pkalever
Copy link
Author

@idryomov Thanks for the quick review. I had incorporated the review comments.

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Copy link
Contributor

@idryomov idryomov left a comment

Choose a reason for hiding this comment

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

LGTM. I don't like the #ifdef mess, but I can clean it up in a separate PR.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants