[PATCH 0/3] qemu: Add possibility to bypass read-write check for device disk backends
See 3/3 for explanation. Peter Krempa (3): qemuxmlconftest: Add 'disk-misc' test case for miscelaneous disk properties qemu: capabilities: Introduce QEMU_CAPS_HOST_DEVICE_ACCEPT_READ_ONLY qemu: Add possibility to bypass read-write check for device disk backends docs/formatdomain.rst | 7 +++ src/conf/domain_conf.c | 13 ++++++ src/conf/schemas/domaincommon.rng | 5 ++ src/conf/storage_source_conf.c | 1 + src/conf/storage_source_conf.h | 3 ++ src/qemu/qemu_block.c | 4 ++ src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_domain.c | 8 ++++ .../caps_11.2.0_aarch64.xml | 1 + .../caps_11.2.0_x86_64.xml | 1 + .../disk-misc.x86_64-latest.args | 38 +++++++++++++++ .../disk-misc.x86_64-latest.xml | 46 +++++++++++++++++++ tests/qemuxmlconfdata/disk-misc.xml | 31 +++++++++++++ tests/qemuxmlconftest.c | 1 + 15 files changed, 162 insertions(+) create mode 100644 tests/qemuxmlconfdata/disk-misc.x86_64-latest.args create mode 100644 tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/disk-misc.xml -- 2.56.1
From: Peter Krempa <pkrempa@redhat.com> QEMU when instantiating a 'host_device' blockdev backend performs checks to ensure that the device is actually writable (per host's kernel) when the device is to be opened in read-write mode. For configurations where the storage is marked as read-only while waiting for failover which happens at guest OS level this would prevent the start of the failover VM which is waiting for the primary one to fail as it wouldn't be able to open the device in read-write mode and then perform failover later during runtime. QEMU introduced a new property 'accept-read-only-device' for the 'host-device' backend, so libvirt needs to expose it to users. Signed-off-by: Peter Krempa <pipo@pipo.sk> --- docs/formatdomain.rst | 7 +++++++ src/conf/domain_conf.c | 13 +++++++++++++ src/conf/schemas/domaincommon.rng | 5 +++++ src/conf/storage_source_conf.c | 1 + src/conf/storage_source_conf.h | 3 +++ src/qemu/qemu_block.c | 4 ++++ src/qemu/qemu_domain.c | 8 ++++++++ tests/qemuxmlconfdata/disk-misc.x86_64-latest.args | 4 ++++ tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml | 12 ++++++++++++ tests/qemuxmlconfdata/disk-misc.xml | 10 ++++++++++ 10 files changed, 67 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 11a4efb8d8..3f219378a7 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3054,6 +3054,13 @@ paravirtualized driver is specified via the ``disk`` element. ``block`` The ``dev`` attribute specifies the fully-qualified path to the host device to serve as the disk. :since:`Since 0.0.3` + + The optional ``accept-read-only-dev`` :since:`(Since 12.10.0)` attribute + when set to ``yes`` instructs the hypervisor to avoid checks enforcing + that device passed as ``dev`` is writable when the disk is in read-write + mode. This is useful for failover scenarios where the storage may be + considered read-only by the host kernel but at failover the device will + start accepting writes. ``dir`` The ``dir`` attribute specifies the fully-qualified path to the directory to use as the disk. :since:`Since 0.7.5` diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 360287cd8e..ad7bbcd2f4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7951,9 +7951,17 @@ virDomainStorageSourceParse(xmlNodePtr node, src->path = virXMLPropString(node, "file"); src->fdgroup = virXMLPropString(node, "fdgroup"); break; + case VIR_STORAGE_TYPE_BLOCK: src->path = virXMLPropString(node, "dev"); + + if (virXMLPropTristateBool(node, "accept-read-only-dev", + VIR_XML_PROP_NONE, + &src->block_accept_readonly_dev) < 0) + return -1; + break; + case VIR_STORAGE_TYPE_DIR: src->path = virXMLPropString(node, "dir"); break; @@ -24435,6 +24443,11 @@ virDomainDiskSourceFormat(virBuffer *buf, case VIR_STORAGE_TYPE_BLOCK: virBufferEscapeString(&attrBuf, " dev='%s'", src->path); + + if (src->block_accept_readonly_dev != VIR_TRISTATE_BOOL_ABSENT) + virBufferAsprintf(&attrBuf, " accept-read-only-dev='%s'", + virTristateBoolTypeToString(src->block_accept_readonly_dev)); + break; case VIR_STORAGE_TYPE_DIR: diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng index 377052830e..77e9f0be92 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -2046,6 +2046,11 @@ </choice> </attribute> </optional> + <optional> + <attribute name="accept-read-only-dev"> + <ref name="virYesNo"/> + </attribute> + </optional> <ref name="diskSourceCommon"/> <optional> <ref name="storageStartupPolicy"/> diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index 010b44ccb0..23081cd140 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -822,6 +822,7 @@ virStorageSourceCopy(const virStorageSource *src, def->timeout = src->timeout; def->reconnectDelay = src->reconnectDelay; def->metadataCacheMaxSize = src->metadataCacheMaxSize; + def->block_accept_readonly_dev = src->block_accept_readonly_dev; /* storage driver metadata are not copied */ def->drv = NULL; diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index fa71a9ef39..fb955b6bdc 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -284,6 +284,9 @@ struct _virStorageSource { virStorageType type; char *path; char *fdgroup; /* name of group of file descriptors the user wishes to use instead of 'path' */ + virTristateBool block_accept_readonly_dev; /* hypervisor should open device regardless + of if the kernel considers it read-only in + read-write mode */ virStorageNetProtocol protocol; char *snapshot; /* for storage systems supporting internal snapshots */ char *configFile; /* some storage systems use config file as part of diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 324c2635b4..de124c95a4 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -791,6 +791,7 @@ qemuBlockStorageSourceGetFileProps(virStorageSource *src, const char *path = src->path; const char *iomode = NULL; const char *prManagerAlias = NULL; + virTristateBool accept_read_only_device = VIR_TRISTATE_BOOL_ABSENT; virJSONValue *ret = NULL; if (!onlytarget) { @@ -804,12 +805,15 @@ qemuBlockStorageSourceGetFileProps(virStorageSource *src, if (srcpriv && srcpriv->fdpass) path = qemuFDPassGetPath(srcpriv->fdpass); + + accept_read_only_device = src->block_accept_readonly_dev; } ignore_value(virJSONValueObjectAdd(&ret, "s:filename", path, "S:aio", iomode, "S:pr-manager", prManagerAlias, + "T:accept-read-only-device", accept_read_only_device, NULL) < 0); return ret; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a4e5f92840..360c33c078 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4888,6 +4888,14 @@ qemuDomainValidateStorageSource(virStorageSource *src, } } + if (src->block_accept_readonly_dev != VIR_TRISTATE_BOOL_ABSENT) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_HOST_DEVICE_ACCEPT_READ_ONLY)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("'accept-read-only-dev' option is not supported by this QEMU")); + return -1; + } + } + return 0; } diff --git a/tests/qemuxmlconfdata/disk-misc.x86_64-latest.args b/tests/qemuxmlconfdata/disk-misc.x86_64-latest.args index 86a63522a8..5949280289 100644 --- a/tests/qemuxmlconfdata/disk-misc.x86_64-latest.args +++ b/tests/qemuxmlconfdata/disk-misc.x86_64-latest.args @@ -28,6 +28,10 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ -device '{"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.0","addr":"0x2"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/failover1","accept-read-only-device":true,"node-name":"libvirt-2-storage","read-only":false}' \ +-device '{"driver":"scsi-hd","bus":"scsi0.0","channel":0,"scsi-id":0,"lun":1,"device_id":"drive-scsi0-0-0-1","drive":"libvirt-2-storage","id":"scsi0-0-0-1","bootindex":1}' \ +-blockdev '{"driver":"host_device","filename":"/dev/failover2","accept-read-only-device":true,"node-name":"libvirt-1-storage","read-only":false}' \ +-device '{"driver":"scsi-block","bus":"scsi0.0","channel":0,"scsi-id":0,"lun":2,"drive":"libvirt-1-storage","id":"scsi0-0-0-2"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ diff --git a/tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml b/tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml index 993ab96911..cad5fd1874 100644 --- a/tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml +++ b/tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml @@ -17,6 +17,18 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> + <disk type='block' device='disk'> + <driver name='qemu' type='raw'/> + <source dev='/dev/failover1' accept-read-only-dev='yes'/> + <target dev='sda' bus='scsi'/> + <address type='drive' controller='0' bus='0' target='0' unit='1'/> + </disk> + <disk type='block' device='lun'> + <driver name='qemu' type='raw'/> + <source dev='/dev/failover2' accept-read-only-dev='yes'/> + <target dev='sdb' bus='scsi'/> + <address type='drive' controller='0' bus='0' target='0' unit='2'/> + </disk> <controller type='usb' index='0' model='piix3-uhci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuxmlconfdata/disk-misc.xml b/tests/qemuxmlconfdata/disk-misc.xml index 33583e3d16..ce47921fb6 100644 --- a/tests/qemuxmlconfdata/disk-misc.xml +++ b/tests/qemuxmlconfdata/disk-misc.xml @@ -14,6 +14,16 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> + <disk type='block' device='disk'> + <source dev='/dev/failover1' accept-read-only-dev='yes'/> + <target dev='sda' bus='scsi'/> + <address type='drive' controller='0' bus='0' target='0' unit='1'/> + </disk> + <disk type='block' device='lun'> + <source dev='/dev/failover2' accept-read-only-dev='yes'/> + <target dev='sdb' bus='scsi'/> + <address type='drive' controller='0' bus='0' target='0' unit='2'/> + </disk> <controller type='usb' index='0'/> <controller type='scsi' index='0' model='virtio-scsi'/> <memballoon model='virtio'/> -- 2.56.1
On Thu, Nov 19, 2026 at 15:24:03 +0100, Peter Krempa wrote:
From: Peter Krempa <pkrempa@redhat.com>
QEMU when instantiating a 'host_device' blockdev backend performs checks to ensure that the device is actually writable (per host's kernel) when the device is to be opened in read-write mode.
For configurations where the storage is marked as read-only while waiting for failover which happens at guest OS level this would prevent the start of the failover VM which is waiting for the primary one to fail as it wouldn't be able to open the device in read-write mode and then perform failover later during runtime.
QEMU introduced a new property 'accept-read-only-device' for the 'host-device' backend, so libvirt needs to expose it to users.
Signed-off-by: Peter Krempa <pipo@pipo.sk> --- docs/formatdomain.rst | 7 +++++++ src/conf/domain_conf.c | 13 +++++++++++++ src/conf/schemas/domaincommon.rng | 5 +++++ src/conf/storage_source_conf.c | 1 + src/conf/storage_source_conf.h | 3 +++ src/qemu/qemu_block.c | 4 ++++ src/qemu/qemu_domain.c | 8 ++++++++ tests/qemuxmlconfdata/disk-misc.x86_64-latest.args | 4 ++++ tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml | 12 ++++++++++++ tests/qemuxmlconfdata/disk-misc.xml | 10 ++++++++++ 10 files changed, 67 insertions(+) ... diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index 010b44ccb0..23081cd140 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -822,6 +822,7 @@ virStorageSourceCopy(const virStorageSource *src, def->timeout = src->timeout; def->reconnectDelay = src->reconnectDelay; def->metadataCacheMaxSize = src->metadataCacheMaxSize; + def->block_accept_readonly_dev = src->block_accept_readonly_dev;
/* storage driver metadata are not copied */ def->drv = NULL; diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index fa71a9ef39..fb955b6bdc 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -284,6 +284,9 @@ struct _virStorageSource { virStorageType type; char *path; char *fdgroup; /* name of group of file descriptors the user wishes to use instead of 'path' */ + virTristateBool block_accept_readonly_dev; /* hypervisor should open device regardless + of if the kernel considers it read-only in + read-write mode */
The comment is not very clear to me. How about hypervisor should open the device in read-write mode even if the kernel considers it read-only
virStorageNetProtocol protocol; char *snapshot; /* for storage systems supporting internal snapshots */ char *configFile; /* some storage systems use config file as part of
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com> Detect that the 'host_device' block device backend supports 'accept-read-only-device' property. This will be used for allowing failover scenarios for storage backends which are marked as read-only by the storage system but need to be opened in read-write mode in qemu to facilitate failover in the guest OS. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_11.2.0_aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_11.2.0_x86_64.xml | 1 + 4 files changed, 5 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 311dd54f37..b9d8e726db 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -789,6 +789,7 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 510 */ "intel-iommu.pasid-bits", /* QEMU_CAPS_INTEL_IOMMU_PASID_BITS */ "intel-iommu.svm", /* QEMU_CAPS_INTEL_IOMMU_SVM */ + "host_device.accept-read-only-device", /* QEMU_CAPS_HOST_DEVICE_ACCEPT_READ_ONLY */ ); @@ -1686,6 +1687,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = { { "blockdev-add/arg-type/+file/drop-cache", QEMU_CAPS_MIGRATION_FILE_DROP_CACHE }, { "blockdev-add/arg-type/+nvme", QEMU_CAPS_DRIVE_NVME }, { "blockdev-add/arg-type/+file/aio/^io_uring", QEMU_CAPS_AIO_IO_URING }, + { "blockdev-add/arg-type/+host_device/accept-read-only-device", QEMU_CAPS_HOST_DEVICE_ACCEPT_READ_ONLY }, { "blockdev-add/arg-type/+rbd/encrypt", QEMU_CAPS_RBD_ENCRYPTION }, { "blockdev-add/arg-type/+rbd/encrypt/parent", QEMU_CAPS_RBD_ENCRYPTION_LAYERING }, { "blockdev-add/arg-type/+rbd/encrypt/format/^luks-any", QEMU_CAPS_RBD_ENCRYPTION_LUKS_ANY }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 2602c4644c..83e27649a8 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -763,6 +763,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 510 */ QEMU_CAPS_INTEL_IOMMU_PASID_BITS, /* intel-iommu.pasid-bits */ QEMU_CAPS_INTEL_IOMMU_SVM, /* intel-iommu.svm */ + QEMU_CAPS_HOST_DEVICE_ACCEPT_READ_ONLY, /* 'host_device' block backend has 'accept-read-only-device' property */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_11.2.0_aarch64.xml b/tests/qemucapabilitiesdata/caps_11.2.0_aarch64.xml index 4f4c7f25b4..6a73cf303e 100644 --- a/tests/qemucapabilitiesdata/caps_11.2.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_11.2.0_aarch64.xml @@ -200,6 +200,7 @@ <flag name='pcie-root-port.speed'/> <flag name='pcie-root-port.width'/> <flag name='vfio-pci.ats'/> + <flag name='host_device.accept-read-only-device'/> <version>11001050</version> <microcodeVersion>61700288</microcodeVersion> <package>v11.1.0-3637-gf29ccc287a</package> diff --git a/tests/qemucapabilitiesdata/caps_11.2.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_11.2.0_x86_64.xml index c9de9c77ea..e77ff19804 100644 --- a/tests/qemucapabilitiesdata/caps_11.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_11.2.0_x86_64.xml @@ -234,6 +234,7 @@ <flag name='intel-iommu.fsts'/> <flag name='intel-iommu.pasid-bits'/> <flag name='intel-iommu.svm'/> + <flag name='host_device.accept-read-only-device'/> <version>11001050</version> <microcodeVersion>43100288</microcodeVersion> <package>v11.1.0-3637-gf29ccc287a</package> -- 2.56.1
On Thu, Nov 19, 2026 at 15:24:02 +0100, Peter Krempa wrote:
From: Peter Krempa <pkrempa@redhat.com>
Detect that the 'host_device' block device backend supports 'accept-read-only-device' property. This will be used for allowing failover scenarios for storage backends which are marked as read-only by the storage system but need to be opened in read-write mode in qemu to facilitate failover in the guest OS.
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_11.2.0_aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_11.2.0_x86_64.xml | 1 + 4 files changed, 5 insertions(+)
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
From: Peter Krempa <pipo@pipo.sk> The definition can have multiple disks so testing misc disk properties can be achieved by just adding a disk with the property. For now the test case doesn't have any disk. Signed-off-by: Peter Krempa <pipo@pipo.sk> --- .../disk-misc.x86_64-latest.args | 34 +++++++++++++++++++ .../disk-misc.x86_64-latest.xml | 34 +++++++++++++++++++ tests/qemuxmlconfdata/disk-misc.xml | 21 ++++++++++++ tests/qemuxmlconftest.c | 1 + 4 files changed, 90 insertions(+) create mode 100644 tests/qemuxmlconfdata/disk-misc.x86_64-latest.args create mode 100644 tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/disk-misc.xml diff --git a/tests/qemuxmlconfdata/disk-misc.x86_64-latest.args b/tests/qemuxmlconfdata/disk-misc.x86_64-latest.args new file mode 100644 index 0000000000..86a63522a8 --- /dev/null +++ b/tests/qemuxmlconfdata/disk-misc.x86_64-latest.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \ +-accel tcg \ +-cpu qemu64 \ +-m size=219136k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=@mon-fd@,server=on,wait=off \ +-object '{"qom-type":"monitor-qmp","id":"monitor","chardev":"charmonitor"}' \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ +-device '{"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.0","addr":"0x2"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml b/tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml new file mode 100644 index 0000000000..993ab96911 --- /dev/null +++ b/tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml @@ -0,0 +1,34 @@ +<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> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> + <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> + <controller type='usb' index='0' model='piix3-uhci'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='scsi' index='0' model='virtio-scsi'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <audio id='1' type='none'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/disk-misc.xml b/tests/qemuxmlconfdata/disk-misc.xml new file mode 100644 index 0000000000..33583e3d16 --- /dev/null +++ b/tests/qemuxmlconfdata/disk-misc.xml @@ -0,0 +1,21 @@ +<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> + <controller type='usb' index='0'/> + <controller type='scsi' index='0' model='virtio-scsi'/> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index e89fef5658..48a52934ce 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -1692,6 +1692,7 @@ mymain(void) ARG_END); DO_TEST_CAPS_LATEST("disk-usb-device-model"); DO_TEST_CAPS_LATEST_PARSE_ERROR("disk-usb-pci"); + DO_TEST_CAPS_LATEST("disk-misc"); DO_TEST_CAPS_LATEST("disk-scsi"); DO_TEST_CAPS_LATEST("disk-scsi-device-auto"); DO_TEST_CAPS_LATEST("disk-scsi-disk-split"); -- 2.56.1
On Thu, Nov 19, 2026 at 15:24:01 +0100, Peter Krempa wrote:
From: Peter Krempa <pipo@pipo.sk>
The definition can have multiple disks so testing misc disk properties can be achieved by just adding a disk with the property. For now the test case doesn't have any disk.
Signed-off-by: Peter Krempa <pipo@pipo.sk> --- .../disk-misc.x86_64-latest.args | 34 +++++++++++++++++++ .../disk-misc.x86_64-latest.xml | 34 +++++++++++++++++++ tests/qemuxmlconfdata/disk-misc.xml | 21 ++++++++++++ tests/qemuxmlconftest.c | 1 + 4 files changed, 90 insertions(+) create mode 100644 tests/qemuxmlconfdata/disk-misc.x86_64-latest.args create mode 100644 tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/disk-misc.xml
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
participants (2)
-
Jiri Denemark -
Peter Krempa