Skip to content

rbd-nbd: output format support for list-mapped command#19704

Merged
dillaman merged 2 commits intoceph:masterfrom
trociny:wip-nbd-format
Jan 7, 2018
Merged

rbd-nbd: output format support for list-mapped command#19704
dillaman merged 2 commits intoceph:masterfrom
trociny:wip-nbd-format

Conversation

@trociny
Copy link
Contributor

@trociny trociny commented Dec 27, 2017

No description provided.

if (cfg.snapname.empty()) {
cfg.snapname = "-";
if (f) {
f->open_object_section(stringify(pid).c_str());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used pid as object section name (and f->open_object_section("devices") above) to make output be similar to what krbd returns [1]. Unfortunately it generates invalid xml:

zhuzha:~/ceph/ceph.ci/build% ./bin/rbd-nbd --pretty-format --format xml list-mapped | xmllint -
-:2: parser error : StartTag: invalid element name
 <6298>
  ^

I suppose a proper solution is:

f->open_array_section("devices");
...
f->open_object_section("device");
f->dump_int("id", pid);

But then it will be incompatible with krbd. It would be nice to fix krbd, but then it will break backward compatibility...

[1] https://github.com/ceph/ceph/blob/master/src/krbd.cc#L642

Copy link

Choose a reason for hiding this comment

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

Since you have the PR to combine all the block device actions, that will allow us the opportunity to fix the XML (i.e. the old "rbd showmapped" dumps the invalid XML whereas the new "rbd device list" uses the corrected format). Therefore, I'd say you should probably do it the correct way here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dillaman It looks like I misunderstood what you proposed in [1]? Because I thought the idea was to get rid of (depricate) "rbd ..." commands and use for any device type what we already had for krbd (rbd map, rbd unmap, rbd showmapped) specifying the device type via an option.

[1] http://tracker.ceph.com/issues/20762

Copy link
Contributor Author

@trociny trociny Jan 2, 2018

Choose a reason for hiding this comment

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

@dillaman Sorry, never mind. I didn't see your comment in that PR.

Copy link

Choose a reason for hiding this comment

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

@trociny That specific tracker ticket was actually for "rbdmap" init / systemd script [1] that automatically maps images upon startup. I thought there was a ticket for merging the rbd CLI block device actions, but I can't find it right now. Definitely good since I also want to add support for TCMU/librbd.

[1] https://github.com/ceph/ceph/blob/master/src/rbdmap

@trociny trociny force-pushed the wip-nbd-format branch 2 times, most recently from ed1192c to d486ad9 Compare December 27, 2017 20:13
@liewegas liewegas requested a review from badone December 29, 2017 15:34
Signed-off-by: Mykola Golub <mgolub@suse.com>
(to make output look similar to krbd)

Signed-off-by: Mykola Golub <mgolub@suse.com>
@trociny
Copy link
Contributor Author

trociny commented Jan 3, 2018

updated to generate a valid xml (as it was discussed)

Copy link

@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

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.

2 participants