Skip to content
This repository has been archived by the owner on Sep 22, 2020. It is now read-only.

torusblk: support nbd detach command #321

Merged
merged 3 commits into from
Sep 14, 2016
Merged

torusblk: support nbd detach command #321

merged 3 commits into from
Sep 14, 2016

Conversation

nak3
Copy link
Contributor

@nak3 nak3 commented Sep 11, 2016

No description provided.

@barakmich
Copy link
Contributor

Perhaps you could help explain the desired lifecycle? Right now, as long as the process is running, it is attached, and it detaches on exit.

@nak3
Copy link
Contributor Author

nak3 commented Sep 13, 2016

Sure. This patch solves two issues:

  1. When we run torusblk nbd <VOLUME> /dev/nbdN as background process, we need to stop the process with kill command.
  2. If torusblk nbd process failed to clean up device during its exit, there are no way to clean up the device by users.

This patch still keep the life cycle, attached during running process and detached during the exit. I am thinking that administrators need this command for above two reason.

@barakmich
Copy link
Contributor

I see. would it be possible to make "attach" the default action for torusblk nbd?

@nak3
Copy link
Contributor Author

nak3 commented Sep 14, 2016

Sure, I updated. One reason why I wanted to add attach subcommand is that, torusblk nbd's help output conflict with --detach option.

It says that the command need VOLUME, but --detach option needs only NBD-DEV.

Usage:
  torusblk nbd VOLUME [NBD-DEV] [flags]

So, I added the example in Flag output.

Flags:
  -d, --detach string   detach an NBD device from a block volume. (e.g. torsublk nbd -d /dev/nbd0)

Copy link
Contributor

@barakmich barakmich left a comment

Choose a reason for hiding this comment

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

Good compromise! LGTM

@barakmich barakmich merged commit 15b77f3 into coreos:master Sep 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants