<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 25, 2020 at 7:32 PM Jason Dillaman <<a href="mailto:jdillama@redhat.com">jdillama@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Aug 25, 2020 at 2:55 AM Han Han <<a href="mailto:hhan@redhat.com" target="_blank">hhan@redhat.com</a>> wrote:<br>
><br>
><br>
><br>
> On Mon, Aug 24, 2020 at 11:09 PM Jason Dillaman <<a href="mailto:jdillama@redhat.com" target="_blank">jdillama@redhat.com</a>> wrote:<br>
>><br>
>> On Mon, Aug 24, 2020 at 10:52 AM Daniel P. Berrangé <<a href="mailto:berrange@redhat.com" target="_blank">berrange@redhat.com</a>> wrote:<br>
>> ><br>
>> > On Mon, Aug 24, 2020 at 10:19:59PM +0800, Han Han wrote:<br>
>> > > On Fri, Aug 21, 2020 at 8:01 PM Jason Dillaman <<a href="mailto:jdillama@redhat.com" target="_blank">jdillama@redhat.com</a>> wrote:<br>
>> > ><br>
>> > > > On Fri, Aug 7, 2020 at 5:50 AM Han Han <<a href="mailto:hhan@redhat.com" target="_blank">hhan@redhat.com</a>> wrote:<br>
>> > > > ><br>
>> > > > > Diff from v3:<br>
>> > > > > - add the check for capability of rbd namespace<br>
>> > > > > - rename the item of rbd namespace in disk source struct<br>
>> > > > > - combine the commit of doc into the commit of patch<br>
>> > > > > - remove the code for -drive<br>
>> > > > ><br>
>> > > > > gitlab branch:<br>
>> > > > > <a href="https://gitlab.com/hhan2/libvirt/-/commits/rbd-namespace-v4" rel="noreferrer" target="_blank">https://gitlab.com/hhan2/libvirt/-/commits/rbd-namespace-v4</a><br>
>> > > > ><br>
>> > > > > Han Han (4):<br>
>> > > > >   qemu_capabilities: Add QEMU_CAPS_RBD_NAMESPACE<br>
>> > > > >   conf: Support to parse rbd namespace attribute<br>
>> > > > >   qemu: Implement rbd namespace attribute<br>
>> > > > >   news: qemu: Support rbd namespace<br>
>> > > > ><br>
>> > > > >  NEWS.rst                                      |  6 +++<br>
>> > > > >  docs/formatdomain.rst                         |  5 ++-<br>
>> > > > >  docs/schemas/domaincommon.rng                 |  3 ++<br>
>> > > > >  src/conf/domain_conf.c                        |  4 ++<br>
>> > > > >  src/qemu/qemu_block.c                         |  1 +<br>
>> > > > >  src/qemu/qemu_capabilities.c                  |  4 ++<br>
>> > > > >  src/qemu/qemu_capabilities.h                  |  3 ++<br>
>> > > > >  src/qemu/qemu_domain.c                        |  8 ++++<br>
>> > > > >  src/util/virstoragefile.h                     |  1 +<br>
>> > > > >  .../caps_5.0.0.aarch64.xml                    |  1 +<br>
>> > > > >  .../qemucapabilitiesdata/caps_5.0.0.ppc64.xml |  1 +<br>
>> > > > >  .../caps_5.0.0.riscv64.xml                    |  1 +<br>
>> > > > >  .../caps_5.0.0.x86_64.xml                     |  1 +<br>
>> > > > >  .../caps_5.1.0.x86_64.xml                     |  1 +<br>
>> > > > >  ...k-network-rbd-namespace.x86_64-latest.args | 41 +++++++++++++++++++<br>
>> > > > >  .../disk-network-rbd-namespace.xml            | 33 +++++++++++++++<br>
>> > > > >  tests/qemuxml2argvtest.c                      |  1 +<br>
>> > > > >  ...sk-network-rbd-namespace.x86_64-latest.xml | 41 +++++++++++++++++++<br>
>> > > > >  tests/qemuxml2xmltest.c                       |  1 +<br>
>> > > > >  19 files changed, 156 insertions(+), 1 deletion(-)<br>
>> > > > >  create mode 100644<br>
>> > > > tests/qemuxml2argvdata/disk-network-rbd-namespace.x86_64-latest.args<br>
>> > > > >  create mode 100644 tests/qemuxml2argvdata/disk-network-rbd-namespace.xml<br>
>> > > > >  create mode 100644<a href="https://www.spinics.net/linux/fedora/libvir/msg201067.html" rel="noreferrer" target="_blank">https://www.spinics.net/linux/fedora/libvir/msg201067.html</a><br>
>> > > > tests/qemuxml2xmloutdata/disk-network-rbd-namespace.x86_64-latest.xml<br>
>> > > > ><br>
>> > > > > --<br>
>> > > > > 2.27.0<br>
>> > > > ><br>
>> > > ><br>
>> > > > Hopefully you still plan to add a "pool" attribute in a future series<br>
>> > > > to help split-up the overloaded "pool/image" name attribute.<br>
>> > > ><br>
>> > > >From my opinions, I think it's ok to keep "pool/image" in the name<br>
>> > > attribute if the meaning of this attribute<br>
>> > > is clarified in libvirt docs.<br>
>> > > Currently I have no plan to split the "pool/image".<br>
>><br>
>><br>
>> The problem is that having separate "<pool>/<image>" and "<pool-name>"<br>
><br>
> <pool-name> ? I am confused here. Do you mean the pool-namespace?<br>
<br>
Yes<br>
<br>
>><br>
>> attributes is semi-nonsensicle. At that point, you might as well just<br>
><br>
> I think the only separated namespace is sensible here. Because there are 3 ways<br>
> to express the rbd image path with namespace:<br>
<br>
Except "pool-namespace" is not a standalone property, it's tied to the<br>
pool that you are hiding in the "name". A "pool-namespace" of "ns1" in<br>
pool "pool1" is not the same as the namespace "ns1" in pool "pool2".<br>
Like I said, you seem to be developing your own unique RBD image-spec<br>
format.<br>
<br>
> 1. <pool>/<namespace>/<image><br>
> e.g: the rbd info comand and the qemu-img comand with legacy rbd path:<br>
> ➜  ~ rbd -c ~/.ceph/ceph.conf -k ~/.ceph/ceph.client.admin.keyring info rbd/hhan/1<br>
> rbd image '1':<br>
>         size 100 MiB in 25 objects<br>
<br>
$ rbd namespace create rbd/ns1<br>
$ rbd create --size 1G rbd/ns1/image1<br>
$ rbd info rbd/ns1/image1<br>
rbd image 'image1':<br>
    size 1 GiB in 256 objects<br>
... snip ...<br>
<br>
The rbd CLI will always treat that middle section as a namespace so<br>
for your example it would be pool rbd, namespace hhan, and image name<br>
1.<br>
<br>
>  ...<br>
> ➜  ~ qemu-img info rbd:rbd/hhan/1:conf=/home/hhan/.ceph/ceph.conf:id=admin:key=XXXXXXX<br>
> image: json:{"driver": "raw", "file": {"pool": "rbd", "image": "1", "conf": "/home/hhan/.ceph/ceph.conf", "driver": "rbd", "user": "admin"}}<br>
> file format: raw<br>
> ...<br>
> Note that the missing namespace attribute in image json is caused by <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1821528" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=1821528</a><br>
><br>
> 2. only separated namespace: <pool>/><image> and namespace attribute or option<br>
> e.g: the rbd command with namespace option<br>
> ➜  ~ rbd -c ~/.ceph/ceph.conf -k ~/.ceph/ceph.client.admin.keyring info rbd/1 --namespace hhan<br>
> rbd image '1':<br>
>         size 100 MiB in 25 objects<br>
>         order 22 (4 MiB objects)<br>
> ...<br>
><br>
> 3. separated pool, namespace, image<br>
> e.g: qemu blockdev options of rbd: <a href="https://github.com/qemu/qemu/blob/30aa19446d82358a30eac3b556b4d6641e00b7c1/qapi/block-core.json#L3585" rel="noreferrer" target="_blank">https://github.com/qemu/qemu/blob/30aa19446d82358a30eac3b556b4d6641e00b7c1/qapi/block-core.json#L3585</a><br>
> ➜  ~ qemu-img info 'json:{"driver": "raw", "file": {"pool": "rbd", "image": "1", "conf": "/home/hhan/.ceph/ceph.conf", "driver": "rbd", "user": "admin", "namespace":"hhan"}}'<br>
> image: json:{"driver": "raw", "file": {"pool": "rbd", "image": "1", "conf": "/home/hhan/.ceph/ceph.conf", "driver": "rbd", "user": "admin"}}<br>
> file format: raw<br>
> ...<br>
><br>
><br>
> From these precedents, I think it is no problem to use the 2nd pattern in libvirt XML.<br>
> I reject the 1st pattern because of compat issues.<br>
> Suppose the 1st pattern is used, it will cause problems in the following case.<br>
> Since rbd allows the image name contains '/'<br>
<br>
That's not true, RBD has not permitted "/" in pool nor image names for<br>
years -- and it's definitely not allowed when creating images in<br>
namespaces:<br>
<br>
$ rbd create --size 1G rbd/ns1/image1/<br>
rbd: invalid spec 'rbd/ns1/image1/'<br>
$ rbd create --size 1G --pool rbd --namespace ns1 --image "image1/"<br>
rbd: invalid spec 'image1/'<br></blockquote><div>I am not sure how I created the image 'hhan/2'  in the default namespace. It cannot be created by</div><div>rbd command now. However it seems buggy on qemu-img(librbd1-12.2.7-9.el8.x86_64 qemu-img-5.1.0-3.module+el8.3.0+7708+740a1315.x86_64):</div><div>➜  ~ rbd -c ~/.ceph/ceph.conf -k ~/.ceph/ceph.client.admin.keyring namespace ls                      <br>NAME <br>hhan <br>test</div><div>➜  ~ qemu-img create  'rbd:rbd/aa/new1:conf=/root/.ceph/ceph.conf:id=admin:key=AQBm9fldc9zhMhAAeDDedFhu55XjV1YhdqDOkQ==' 1M<br>Formatting 'rbd:rbd/aa/new1:conf=/root/.ceph/ceph.conf:id=admin:key=AQBm9fldc9zhMhAAeDDedFhu55XjV1YhdqDOkQ==', fmt=raw size=1048576<br>➜  ~ qemu-img create  'rbd:rbd/aa/new1:conf=/root/.ceph/ceph.conf:id=admin:key=AQBm9fldc9zhMhAAeDDedFhu55XjV1YhdqDOkQ==' 1M<br>Formatting 'rbd:rbd/aa/new1:conf=/root/.ceph/ceph.conf:id=admin:key=AQBm9fldc9zhMhAAeDDedFhu55XjV1YhdqDOkQ==', fmt=raw size=1048576<br>qemu-img: rbd:rbd/aa/new1:conf=/root/.ceph/ceph.conf:id=admin:key=AQBm9fldc9zhMhAAeDDedFhu55XjV1YhdqDOkQ==: error rbd create: File exists</div><div>➜  ~ rbd -c ~/.ceph/ceph.conf -k ~/.ceph/ceph.client.admin.keyring namespace ls<br>NAME <br>hhan <br>test <br></div><div>➜  ~ rbd -c ~/.ceph/ceph.conf -k ~/.ceph/ceph.client.admin.keyring -p rbd ls|grep new1</div><div>➜  ~ qemu-img info rbd:rbd/aa/new1:conf=/root/.ceph/ceph.conf:id=admin:key=AQBm9fldc9zhMhAAeDDedFhu55XjV1YhdqDOkQ==<br>image: json:{"driver": "raw", "file": {"pool": "rbd", "image": "new1", "conf": "/root/.ceph/ceph.conf", "driver": "rbd", "user": "admin"}}<br>file format: raw<br>virtual size: 1 MiB (1048576 bytes)<br>disk size: unavailable<br>cluster_size: 4194304</div><div><br></div><div>Well, the image "rbd/aa/new1" could be found by qemu-img but cannot be listed by rbd. Very confusing here. <br></div><div><br></div><div>Since the '/' in image name is invalid, the format of name attribute "<pool>/[pool-ns]<image>" is more sensible.</div><div>I will adapt that in the next patch series.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Is this a bug in "qemu-img" that allowed you to create "hhan/2" below?<br>
Does it allow you to create that image in a namespace or does your<br>
example no longer work? QEMU should also parse that middle section as<br>
the namespace [1].<br>
<br>
> ➜  ~ rbd -c ~/.ceph/ceph.conf -k ~/.ceph/ceph.client.admin.keyring -p rbd ls<br>
> attach-new<br>
> copy<br>
> hhan/2<br>
><br>
> If I used 'hhan/2' image in libvirt XML at the previous libvirt and then I updated libvirt to the version support 1st pattern,<br>
> the new libvirt parse the name='rbd/hhan/2' as pool 'rbd', namespace 'hhan', image '2',instead of the pool 'rbd', image<br>
> 'hhan/2', default namespace.<br>
><br>
><br>
> For the 3rd pattern, separating all the attributes, the xml will look like<br>
> <source protocol="rbd" pool="POOL" image="IMG" namespace="NS"><br>
><br>
> However it cannot replace the old attribute name='<pool>/<image>' because of the compatibility.<br>
> What about keeping the old attribute the adapting this new pattern?<br>
> Well, it looks weird only rbd protocol adapts this new pattern because all the network protocols in libvirt<br>
> use the old xml pattern <source protocol="PROTO" name="XX"> (seeing the examples in <a href="https://libvirt.org/formatdomain.html#hard-drives-floppy-disks-cdroms" rel="noreferrer" target="_blank">https://libvirt.org/formatdomain.html#hard-drives-floppy-disks-cdroms</a>)<br>
> How about adapting this new pattern to all the network protocols?<br>
> Considering the effort and the benifits of that, I think it is not worthwhile.<br>
><br>
>> drop the "pool_namespace" attribute" and parse the image name just<br>
>> like the rest of Ceph/RBD code does as<br>
>> "[<pool-name>/[<pool_namespace>/]]<image-name>". Why should libvirt<br>
>> invent its own custom way to describe the image location?<br>
>><br>
>> See this thread here [1] from back in April where you said you would<br>
>> split it out.<br>
>><br>
> Yes.<br>
> The above is why I changed my mind and decided to use the only separated attribute namespace.<br>
>><br>
>> > That would create back compat issues too, so I can't see us splitting<br>
>> > that.<br>
>><br>
>> Yes, I understand the backwards compatibility concerns so you would<br>
>> need to continue to support "<pool>/<image>", but you could at least<br>
>> force the new format if a "<pool-namespace>" was specified.<br>
>><br>
>><br>
>><br>
>> > Regards,<br>
>> > Daniel<br>
>> > --<br>
>> > |: <a href="https://berrange.com" rel="noreferrer" target="_blank">https://berrange.com</a>      -o-    <a href="https://www.flickr.com/photos/dberrange" rel="noreferrer" target="_blank">https://www.flickr.com/photos/dberrange</a> :|<br>
>> > |: <a href="https://libvirt.org" rel="noreferrer" target="_blank">https://libvirt.org</a>         -o-            <a href="https://fstop138.berrange.com" rel="noreferrer" target="_blank">https://fstop138.berrange.com</a> :|<br>
>> > |: <a href="https://entangle-photo.org" rel="noreferrer" target="_blank">https://entangle-photo.org</a>    -o-    <a href="https://www.instagram.com/dberrange" rel="noreferrer" target="_blank">https://www.instagram.com/dberrange</a> :|<br>
>> ><br>
>><br>
>> [1] <a href="https://www.spinics.net/linux/fedora/libvir/msg201067.html" rel="noreferrer" target="_blank">https://www.spinics.net/linux/fedora/libvir/msg201067.html</a><br>
>><br>
>> --<br>
>> Jason<br>
>><br>
><br>
><br>
> --<br>
> Best regards,<br>
> -----------------------------------<br>
> Han Han<br>
> Senior Quality Engineer<br>
> Redhat.<br>
><br>
> Email: <a href="mailto:hhan@redhat.com" target="_blank">hhan@redhat.com</a><br>
> Phone: +861065339333<br>
<br>
[1] <a href="https://github.com/qemu/qemu/blob/master/block/rbd.c#L150" rel="noreferrer" target="_blank">https://github.com/qemu/qemu/blob/master/block/rbd.c#L150</a><br>
<br>
-- <br>
Jason<br>
<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Best regards,</div><div dir="ltr">-----------------------------------<br></div><div dir="ltr">Han Han<br>Senior Quality Engineer<br>Redhat.<br><br>Email: <a href="mailto:hhan@redhat.com" target="_blank">hhan@redhat.com</a><br>Phone: +861065339333<br></div></div></div></div></div></div></div>