rbd: unified way to map images using different drivers#19711
rbd: unified way to map images using different drivers#19711dillaman merged 1 commit intoceph:masterfrom
Conversation
|
Hi mykola, |
wjwithagen
left a comment
There was a problem hiding this comment.
FreeBSD-jenkins thinks it is oke.
http://cephdev.digiware.nl:8180/jenkins/job/ceph-master/1605/console
|
rebased after #19679 was merged |
src/tools/rbd/action/Nbd.cc
Outdated
| Shell::Action action_unmap( | ||
| {"nbd", "unmap"}, {}, "Unmap a nbd device.", "", | ||
| &get_unmap_arguments, &execute_unmap); | ||
| &get_unmap_arguments, &execute_unmap_depricated, false); |
There was a problem hiding this comment.
Updated, thanks.
Also, the man page is updated.
dillaman
left a comment
There was a problem hiding this comment.
Perhaps also swap the workunit tests to use the new commands vs the newly deprecated commands
src/tools/rbd/action/Nbd.cc
Outdated
| ("specify nbd device" + help_suffix).c_str()) | ||
| ("nbds_max", po::value<std::string>(), | ||
| ("override module param nbds_max" + help_suffix).c_str()) | ||
| ("max_part", po::value<std::string>(), |
There was a problem hiding this comment.
Nit: when invoked from Kernel.cc, it might be nice to change the optional to --nbd_(device|max_part|timeout) and only keep it --XYZ for the deprecated action. That way it's immediately clear which options are only valid for NBD maps.
There was a problem hiding this comment.
May be reuse --options, which we already use for krbd? I.e.:
rbd device map -t krbd -o rw,nocrc,mount_timeout=10 ...
rbd device map -t nbd -o nbd_device=256,timeout=10 ...
There was a problem hiding this comment.
Sorry, for nbd I meant something like:
rbd device map -t nbd -o device=/dev/nbd1,max_part=256,timeout=10
There was a problem hiding this comment.
@trociny That works for me -- just need to document the possible options somehow, though
There was a problem hiding this comment.
Or we could make vice versa: for krbd, instead of:
rbd device map -t krbd -o rw,nocrc,mount_timeout=10 ...
have:
rbd device map -t krbd --krbd_rw --krbd_nocrc --krbd_mount_timeout=10 ...
I just would like we have this consistent between different device types.
There was a problem hiding this comment.
Something about nearly a dozen --krbd_XYZ-prefixed optionals makes me prefer the older style instead even though the new style is self-documenting. As a third possibility, perhaps all the driver-specific options can be added to the help only after you specify the type so that they are only accepted as valid optionals when applicable to the current device type:
rbd help device map --device-type nbd
... snip ... snip ... snip ...
Optional arguments
--device arg specify nbd device +
--nbds_max arg override module param nbds_max +
--max_part arg override module param max_part +
--timeout arg set nbd request timeout (seconds) +
@idryomov thoughts?
There was a problem hiding this comment.
rbd help device map --device-type nbd looks too cumbersome to me. I'd vote for reusing -o/--options. It's not self-documenting, but we can make it so -- although personally I'd rather we improve rbd(8) man page.
src/test/cli/rbd/help.t
Outdated
| rename (mv) Rename image within pool. | ||
| resize Resize (expand or shrink) image. | ||
| showmapped Show the rbd images mapped by the kernel. | ||
| showmapped Show mapped rbd images. |
There was a problem hiding this comment.
The showmapped command has always seemed oddly named to me. Perhaps since we are changing/merging, we can just create new "device map", "device list", and "device unmap" commands and deprecate all the older CLI actions(?)
There was a problem hiding this comment.
@dillaman I like "device map|list|unmap" too. I was reluctant to change (deprecate) krbd commands though as in contrast to nbd/ggate they have long history, mentioned in many docs, and are very likely used in many scripts.
But if you and other think it is ok I will change this.
There was a problem hiding this comment.
... I think if we keep it deprecated for two releases, that will leave plenty of time to adjust.
src/tools/rbd/action/Map.cc
Outdated
|
|
||
| Shell::Action action_map( | ||
| {"map"}, {}, "Map an image to a block device.", | ||
| "* kernel device specific option\n" |
There was a problem hiding this comment.
Nit: krbd instead of kernel since the other methods use the kernel as well
|
Updated:
I am using
The things I don't like are two dashes prefix and a space instead of "=" as key-value separator. This might be confusing for users. It looks like it is hardcoded in So, what do you think? Is it a good idea to use |
|
The two dashes thing is going to be highly confusing. I think having map options documented in the man page is sufficient and wouldn't worry about As for the parser, I don't have a strong opinion. The existing |
|
I agree w/ Ilya. The valid options for all block types can just be dumped out as a raw text via long argument help (see |
|
|
||
| :command:`nbd unmap` *device-path* | ||
| Unmap the block device that was mapped via the rbd-nbd tool. | ||
|
|
There was a problem hiding this comment.
Commands map, unmap, showmapped should be dropped also.
There was a problem hiding this comment.
@dillaman On that note, I don't really understand the need to deprecate rbd map, rbd unmap and rbd showmapped. Even if rbd showmapped is weirdly named, they are short, sweet and to the point ;) They also have been around forever, so if the new rbd device commands are added, I'd like to keep the old ones as synonyms.
There was a problem hiding this comment.
One of the need to deprecate rbd showmapped was discussed in #19704: rbd showmapped produces invalid xml, so rbd device list produces a different output (see "krbd: add krbd_list and depricate krbd_showmapped function" commit in this PR).
And I like "device" prefix in the command as it groups these commands in one section when rbd commands are listed alphabetically. Probably we could keep rbd map|unmap|showmapped forever (without a deprecation warning, as aliases, still showmapped producing old format output) but to me in long term it might be more confusing to users.
There was a problem hiding this comment.
Hmm, that's probably not the only place where an XML element name ends up starting with (or being) a number. I wonder if we should teach XMLFormatter to escape these as _xHHHH_ per https://msdn.microsoft.com/en-us/library/system.xml.xmlconvert.encodename(v=vs.110).aspx or similar.
There was a problem hiding this comment.
A quick grep just within rbd revealed do_lock_list, which opens with a lock cookie, which is a free-form string. I'm not sure that's enough to deprecate a command in my book.
There was a problem hiding this comment.
Honestly, the fact that is has been broken for so long probably tells us that no one is using the XML output from rbd showmapped. Encoding the id in hex would be backwards incompatible to any users out there. We've always stated that the output from the CLI is not guarenteed to be stable, so perhaps we just change it, release note it, and move on.
792cf02 to
690776c
Compare
Instead of "rbd map|unmap|showmapped", "rbd ndb map|unmap|list", "rbd ggate map|unmap|list" commands, provide: rbd device -t krbd|nbd|ggate|... map|unmap|list which gives interface consistent between drivers. Signed-off-by: Mykola Golub <mgolub@suse.com>
Signed-off-by: Mykola Golub mgolub@suse.com