[PATCH v3 3/5] qemu: Implement rbd namespace attribute

Peter Krempa pkrempa at redhat.com
Fri Aug 7 09:17:03 UTC 2020


On Fri, Aug 07, 2020 at 17:11:25 +0800, Han Han wrote:
> On Thu, Aug 6, 2020 at 7:58 PM Peter Krempa <pkrempa at redhat.com> wrote:
> 
> > On Thu, Aug 06, 2020 at 19:41:44 +0800, Han Han wrote:
> > > Ceph Nautilus supports separate image namespaces within a pool for
> > > tenant isolation and QEMU added it as a rbd blockdev options from 5.0.0.
> > > This optional attribute is used to access a image with namespace.
> > >
> > > Add unit tests for this attribute.
> > >
> > > https://bugzilla.redhat.com/show_bug.cgi?id=1816909
> > >
> > > Signed-off-by: Han Han <hhan at redhat.com>
> > > ---
> > >  src/qemu/qemu_block.c                         |  1 +
> > >  src/qemu/qemu_command.c                       |  7 +++-
> > >  ...k-network-rbd-namespace.x86_64-latest.args | 41 +++++++++++++++++++
> > >  .../disk-network-rbd-namespace.xml            | 33 +++++++++++++++
> > >  tests/qemuxml2argvtest.c                      |  1 +
> > >  ...sk-network-rbd-namespace.x86_64-latest.xml | 41 +++++++++++++++++++
> > >  tests/qemuxml2xmltest.c                       |  1 +
> > >  7 files changed, 124 insertions(+), 1 deletion(-)
> > >  create mode 100644
> > tests/qemuxml2argvdata/disk-network-rbd-namespace.x86_64-latest.args
> > >  create mode 100644 tests/qemuxml2argvdata/disk-network-rbd-namespace.xml
> > >  create mode 100644
> > tests/qemuxml2xmloutdata/disk-network-rbd-namespace.x86_64-latest.xml
> >
> > [...]
> >
> > > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> > > index 01812cd39b..b6288d1308 100644
> > > --- a/src/qemu/qemu_command.c
> > > +++ b/src/qemu/qemu_command.c
> > > @@ -980,7 +980,12 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src,
> > >                  return NULL;
> > >              }
> > >
> > > -            virBufferStrcat(&buf, "rbd:", src->volume, "/", src->path,
> > NULL);
> > > +            virBufferStrcat(&buf, "rbd:", src->volume, "/", NULL);
> > > +            /* The filename of image with namespace:
> > rbd:POOL/NAMESPACE/IMAGE... */
> > > +            if (src->namespace)
> > > +                virBufferStrcat(&buf, src->namespace, "/", NULL);
> > > +
> > > +            virBufferStrcat(&buf, src->path, NULL);
> > >
> >
> > This is dead code now. qemu-5.0 will be started with -blockdev only.
> >
> > So libvirt will not confirm the functional correctness when -blockdev is
> disabled by <qemu:commandline>
> in qemu 5.0 or after, right?

No. <qemu:capabilities> are specifically described [1] as for
experiments and workarounds only and we don't strive to support anything
which is not obtainable by standard qemu.


[1]:

In some cases e.g. when developing a new feature or for testing it may
be required to control a given qemu feature (or qemu capability) to test
it before it's complete or disable it for debugging purposes. Since
5.5.0 it's possible to use the same special qemu namespace as above
(http://libvirt.org/schemas/domain/qemu/1.0) and use <qemu:capabilities>
element to add (<qemu:add capability="capname"/>) or remove (<qemu:del
capability="capname"/>) capability bits. The naming of the feature bits
is the same libvirt uses in the status XML. Note that this feature is
meant for experiments only and should _not_ be used in production.




More information about the libvir-list mailing list