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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Thu, Aug 6, 2020 at 7:58 PM Peter Krempa <pkrempa@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---
>  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?

>              if (src->snapshot)
>                  virBufferEscape(&buf, '\\', ":", "@%s", src->snapshot);

[...]

> diff --git a/tests/qemuxml2argvdata/disk-network-rbd-namespace.xml b/tests/qemuxml2argvdata/disk-network-rbd-namespace.xml
> new file mode 100644
> index 0000000000..8b526c4a20
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/disk-network-rbd-namespace.xml
> @@ -0,0 +1,33 @@
> +<domain type='qemu'>
> +  <name>QEMUGuest1</name>
> +  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
> +  <memory unit='KiB'>219136</memory>
> +  <currentMemory unit='KiB'>219136</currentMemory>
> +  <vcpu placement='static'>1</vcpu>
> +  <os>
> +    <type arch='x86_64' machine='pc'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <emulator>/usr/bin/qemu-system-x86_64</emulator>
> +    <disk type='network' device='disk'>
> +      <driver name='qemu' type='raw'/>
> +      <source protocol='rbd' name='pool/image' namespace='ns'>
> +        <host name='mon1.example.org' port='6321'/>
> +        <host name='mon2.example.org' port='6322'/>
> +        <host name='mon3.example.org' port='6322'/>
> +      </source>
> +      <target dev='vda' bus='virtio'/>
> +    </disk>
> +    <controller type='usb' index='0'/>
> +    <controller type='ide' index='0'/>
> +    <controller type='pci' index='0' model='pci-root'/>
> +    <input type='mouse' bus='ps2'/>
> +    <input type='keyboard' bus='ps2'/>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>

virschematest fails after adding this file in this patch. You must add
the RNG schema prior to any file using it as we invoke the schema test
on all example files.



--
Best regards,
-----------------------------------
Han Han
Senior Quality Engineer
Redhat.

Email: hhan@xxxxxxxxxx
Phone: +861065339333

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux