rbd-nbd: output format support for list-mapped command#19704
rbd-nbd: output format support for list-mapped command#19704dillaman merged 2 commits intoceph:masterfrom
Conversation
src/tools/rbd_nbd/rbd-nbd.cc
Outdated
| if (cfg.snapname.empty()) { | ||
| cfg.snapname = "-"; | ||
| if (f) { | ||
| f->open_object_section(stringify(pid).c_str()); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
@dillaman Sorry, never mind. I didn't see your comment in that PR.
There was a problem hiding this comment.
@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.
ed1192c to
d486ad9
Compare
d486ad9 to
87a2c78
Compare
Signed-off-by: Mykola Golub <mgolub@suse.com>
(to make output look similar to krbd) Signed-off-by: Mykola Golub <mgolub@suse.com>
87a2c78 to
742187a
Compare
|
updated to generate a valid xml (as it was discussed) |
No description provided.