Diff from v2:
- rebase to master
- update some qemu capabilities tests
Test results of this patch series on qemu-5.0.0 and librbd1-14.2.8:
disk xml:
<disk type='network' device='disk'>
<driver name='qemu' type='raw'/>
<auth username='admin'>
<secret type='ceph' usage='ceph_example'/>
</auth>
<source protocol='rbd' name='rbd/1' namespace='hhan'>
<host name='CEPH_MON'/>
</source>
<target dev='vde' bus='virtio'/>
</disk>
Live attach and detach the disk:
➜ ~ virsh attach-device new /tmp/ceph-ns.xml
Device attached successfully
➜ ~ virsh dumpxml new|xmllint --xpath //disk -
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/var/lib/libvirt/images/new.qcow2"
index="2"/>
<backingStore/>
<target dev="vda" bus="virtio"/>
<serial>WD-WMAP9A966149</serial>
<alias name="virtio-disk0"/>
<address type="pci" domain="0x0000" bus="0x02"
slot="0x00" function="0x0"/>
</disk><disk type="network" device="disk">
<driver name="qemu" type="raw"/>
<auth username="admin">
<secret type="ceph" usage="ceph_example"/>
</auth>
<source protocol="rbd" name="rbd/1"
namespace="hhan" index="3">
<host name="CEPH_MON"/>
</source>
<target dev="vde" bus="virtio"/>
<alias name="virtio-disk4"/>
<address type="pci" domain="0x0000" bus="0x03"
slot="0x00" function="0x0"/>
</disk>
➜ ~ virsh detach-device new /tmp/ceph-ns.xml
Device detached successfully
➜ ~ virsh dumpxml new|xmllint --xpath //disk -
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/var/lib/libvirt/images/new.qcow2"
index="2"/>
<backingStore/>
<target dev="vda" bus="virtio"/>
<serial>WD-WMAP9A966149</serial>
<alias name="virtio-disk0"/>
<address type="pci" domain="0x0000" bus="0x02"
slot="0x00" function="0x0"/>
</disk>
It also works when start VM with this disk.
And tests pass when it is tested with -blockdev disabled:
<domain type='kvm'
xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
[...]
<qemu:capabilities>
<qemu:del capability='blockdev'/>
<qemu:add capability='drive'/>
</qemu:capabilities>
</domain>
v2:
https://www.redhat.com/archives/libvir-list/2020-April/msg00972.html
Han Han (5):
qemu_capabilities: Add QEMU_CAPS_RBD_NAMESPACE
conf: Support to parse rbd namespace attribute
qemu: Implement rbd namespace attribute
doc: rng schemas and html doc for rbd namespace attribute
news: qemu: Support rbd namespace
NEWS.rst | 6 +++
docs/formatdomain.rst | 5 ++-
docs/schemas/domaincommon.rng | 3 ++
src/conf/domain_conf.c | 4 ++
src/qemu/qemu_block.c | 1 +
src/qemu/qemu_capabilities.c | 4 ++
src/qemu/qemu_capabilities.h | 3 ++
src/qemu/qemu_command.c | 7 +++-
src/util/virstoragefile.h | 1 +
.../caps_5.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
.../caps_5.0.0.riscv64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
.../caps_5.1.0.x86_64.xml | 1 +
...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 +
19 files changed, 154 insertions(+), 2 deletions(-)
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
--
2.27.0