[PATCH 00/22] qemu: Refactor blockdev protocol JSON generators ('raw' driver removal part 2)

Second part cleans up tests and various bits and refactors the protocol blockdev JSON configuration generator to be reusable. This still doesn't change the configuration of the blockdevs, just reorders some arguments. Peter Krempa (22): qemuxml2(argv|xml)test: Add network backed disk type='sd' qemu: migration: No longer avoid 'auto-read-only' option for migration qemuBuildDriveSourceStr: Absorb only use of qemuDiskSourceGetProps qemuBlockStorageSourceGetBackendProps: Remove unnecessary indent for non-nbdkit code path conf: Move definition of some disk type enums to a common header virStorageSource: Use proper type for shadow copies of iomode/cachemode/discard/detect_zeroes qemuDomainDiskCachemodeFlags: Simplify usage qemuBlockStorageSourceGetBlockdevGetCacheProps: Return the cache object rather than appending it qemublocktest: Use "target only" mode in 'testJSONtoJSON' and 'testBackingXMLjsonXML' qemublocktest: Drop 'sheepdog' and 'vxhs' test cases qemublocktest: Fix logical bug in TEST_JSON_FORMAT macro qemublocktest: testBackingXMLjsonXML: Drop 'legacy' mode qemuBlockStorageSourceGetBackendProps: Unify cases for '!onlytarget' and '!legacy' virDomainDiskGetDetectZeroesMode: Return proper type qemuBlockStorageSourceGetBackendProps: Unify ordering of fields qemu: block: Add helper to add common properties for -blockdev configuration qemu: block: Use qemuBlockStorageSourceAddBlockdevCommonProps for storage slice qemuBlockStorageSourceGetBackendProps: Introduce QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE qemuBuildHostdevSCSIAttachPrepare: Use "effective node" mode for getting blockdev props qemuBlockStorageSourceGetBackendProps: Use qemuBlockStorageSourceAddBlockdevCommonProps qemuBlockStorageSourceGetBackendProps: Remove unused logic for (auto-)read-only flags qemu: block: Remove unused flags QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_ flags src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 39 +- src/conf/storage_source_conf.h | 8 +- src/conf/virconftypes.h | 39 +- src/qemu/qemu_block.c | 349 +++++++++--------- src/qemu/qemu_block.h | 6 +- src/qemu/qemu_command.c | 63 ++-- src/qemu/qemu_domain.c | 33 +- src/qemu/qemu_domain.h | 4 +- src/qemu/qemu_migration.c | 5 +- tests/qemublocktest.c | 41 +- .../jsontojson/curl-libguestfs-out.json | 5 +- .../ssh-passthrough-libguestfs-out.json | 4 +- .../xml2json/dir-fat-cache.json | 6 +- .../file-backing_basic-cache-directsync.json | 24 +- .../file-backing_basic-cache-none.json | 24 +- .../file-backing_basic-cache-unsafe.json | 24 +- .../file-backing_basic-cache-writeback.json | 24 +- ...file-backing_basic-cache-writethrough.json | 24 +- .../xml2json/file-raw-aio_native.json | 6 +- ...work-qcow2-backing-chain-cache-unsafe.json | 12 +- .../blkdeviotune-group-num.x86_64-latest.args | 4 +- ...blkdeviotune-max-length.x86_64-latest.args | 4 +- .../blkdeviotune-max.x86_64-latest.args | 4 +- .../blkdeviotune.x86_64-latest.args | 4 +- .../controller-order.x86_64-latest.args | 2 +- .../disk-aio.x86_64-latest.args | 2 +- .../disk-arm-virtio-sd.aarch64-latest.args | 2 + tests/qemuxml2argvdata/disk-arm-virtio-sd.xml | 16 + .../disk-cache.x86_64-latest.args | 10 +- .../disk-error-policy-s390x.s390x-latest.args | 6 +- .../disk-error-policy.x86_64-latest.args | 6 +- .../disk-metadata-cache.x86_64-latest.args | 6 +- .../disk-network-nfs.x86_64-latest.args | 2 +- ...rk-tlsx509-nbd-hostname.x86_64-latest.args | 2 +- ...disk-network-tlsx509-nbd.x86_64-5.2.0.args | 2 +- ...isk-network-tlsx509-nbd.x86_64-latest.args | 2 +- ...isk-network-tlsx509-vxhs.x86_64-5.0.0.args | 6 +- .../disk-nvme.x86_64-latest.args | 2 +- .../disk-shared.x86_64-latest.args | 6 +- .../disk-slices.x86_64-latest.args | 8 +- .../disk-snapshot.x86_64-latest.args | 4 +- .../disk-transient.x86_64-latest.args | 2 +- .../disk-vhostvdpa.x86_64-latest.args | 2 +- .../name-escape.x86_64-latest.args | 2 +- .../user-aliases.x86_64-latest.args | 4 +- ...eo-bochs-display-device.x86_64-latest.args | 2 +- ...-device-pciaddr-default.x86_64-latest.args | 2 +- ...video-qxl-device-vgamem.x86_64-latest.args | 2 +- .../video-qxl-device.x86_64-latest.args | 2 +- ...o-qxl-sec-device-vgamem.x86_64-latest.args | 2 +- .../video-qxl-sec-device.x86_64-latest.args | 2 +- ...eo-ramfb-display-device.x86_64-latest.args | 2 +- ...video-vga-device-vgamem.x86_64-latest.args | 2 +- .../video-vga-device.x86_64-latest.args | 2 +- .../video-virtio-blob-off.x86_64-latest.args | 2 +- .../video-virtio-blob-on.x86_64-latest.args | 2 +- ...video-virtio-gpu-device.x86_64-latest.args | 2 +- ...video-virtio-gpu-sdl-gl.x86_64-latest.args | 2 +- ...deo-virtio-gpu-spice-gl.x86_64-latest.args | 2 +- .../video-virtio-gpu-virgl.x86_64-latest.args | 2 +- .../video-virtio-vga.x86_64-latest.args | 2 +- .../disk-arm-virtio-sd.aarch64-latest.xml | 16 + 63 files changed, 438 insertions(+), 462 deletions(-) -- 2.41.0

Add a few examples of SD cards backed with network storage to capture the current state as the formatter code is about to be refactored. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- .../disk-arm-virtio-sd.aarch64-latest.args | 2 ++ tests/qemuxml2argvdata/disk-arm-virtio-sd.xml | 16 ++++++++++++++++ .../disk-arm-virtio-sd.aarch64-latest.xml | 16 ++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-latest.args b/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-latest.args index 5d841604fb..00fdd1759e 100644 --- a/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-latest.args +++ b/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-latest.args @@ -33,6 +33,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-armtest/.config \ -dtb /arm.dtb \ -usb \ -drive file=/arm-sd.qcow2,format=qcow2,if=sd,index=0 \ +-drive file.driver=nbd,file.server.type=inet,file.server.host=localhost,file.server.port=10809,file.export=export,format=qcow2,if=sd,index=1 \ +-drive file.driver=gluster,file.volume=Volume3,file.path=Image.qcow2,file.server.0.type=inet,file.server.0.host=example.org,file.server.0.port=6000,file.server.1.type=inet,file.server.1.host=example.org,file.server.1.port=24007,file.server.2.type=unix,file.server.2.path=/path/to/sock,file.debug=4,format=qcow2,if=sd,index=2 \ -blockdev '{"driver":"file","filename":"/arm-virtio.qcow2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"virtio-blk-device","drive":"libvirt-1-format","id":"virtio-disk0"}' \ diff --git a/tests/qemuxml2argvdata/disk-arm-virtio-sd.xml b/tests/qemuxml2argvdata/disk-arm-virtio-sd.xml index 45a2192d48..9315c12c76 100644 --- a/tests/qemuxml2argvdata/disk-arm-virtio-sd.xml +++ b/tests/qemuxml2argvdata/disk-arm-virtio-sd.xml @@ -26,6 +26,22 @@ <source file='/arm-sd.qcow2'/> <target dev='sda' bus='sd'/> </disk> + <disk type='network' device='disk'> + <driver name='qemu' type='qcow2'/> + <source protocol='nbd' name='export'> + <host name='localhost'/> + </source> + <target dev='sdb' bus='sd'/> + </disk> + <disk type='network' device='disk'> + <driver name='qemu' type='qcow2'/> + <source protocol='gluster' name='Volume3/Image.qcow2'> + <host name='example.org' port='6000'/> + <host name='example.org'/> + <host transport='unix' socket='/path/to/sock'/> + </source> + <target dev='sdc' bus='sd'/> + </disk> <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/arm-virtio.qcow2'/> diff --git a/tests/qemuxml2xmloutdata/disk-arm-virtio-sd.aarch64-latest.xml b/tests/qemuxml2xmloutdata/disk-arm-virtio-sd.aarch64-latest.xml index 962dc8f367..b9d412d3fb 100644 --- a/tests/qemuxml2xmloutdata/disk-arm-virtio-sd.aarch64-latest.xml +++ b/tests/qemuxml2xmloutdata/disk-arm-virtio-sd.aarch64-latest.xml @@ -30,6 +30,22 @@ <source file='/arm-sd.qcow2'/> <target dev='sda' bus='sd'/> </disk> + <disk type='network' device='disk'> + <driver name='qemu' type='qcow2'/> + <source protocol='nbd' name='export'> + <host name='localhost' port='10809'/> + </source> + <target dev='sdb' bus='sd'/> + </disk> + <disk type='network' device='disk'> + <driver name='qemu' type='qcow2'/> + <source protocol='gluster' name='Volume3/Image.qcow2'> + <host name='example.org' port='6000'/> + <host name='example.org' port='24007'/> + <host transport='unix' socket='/path/to/sock'/> + </source> + <target dev='sdc' bus='sd'/> + </disk> <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/arm-virtio.qcow2'/> -- 2.41.0

The 'auto-read-only' blockdev option is available in all supported qemu versions so we can remove the migration hack which disabled it. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 8 ++------ src/qemu/qemu_block.h | 3 +-- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_migration.c | 5 +---- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 0d252552de..e706bb7369 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1513,14 +1513,10 @@ qemuBlockStorageSourceAttachDataFree(qemuBlockStorageSourceAttachData *data) */ qemuBlockStorageSourceAttachData * qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSource *src, - virStorageSource *backingStore, - bool autoreadonly) + virStorageSource *backingStore) { g_autoptr(qemuBlockStorageSourceAttachData) data = NULL; - unsigned int backendpropsflags = 0; - - if (autoreadonly) - backendpropsflags |= QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY; + unsigned int backendpropsflags = QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY; data = g_new0(qemuBlockStorageSourceAttachData, 1); diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 7008a4e7da..7bb83d8d44 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -134,8 +134,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuBlockStorageSourceAttachData, qemuBlockStorageSourceAttachData * qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSource *src, - virStorageSource *backingStore, - bool autoreadonly); + virStorageSource *backingStore); qemuBlockStorageSourceAttachData * qemuBlockStorageSourceDetachPrepare(virStorageSource *src); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d40d3a4e13..ba21976956 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10937,7 +10937,7 @@ qemuBuildStorageSourceChainAttachPrepareBlockdevOne(qemuBlockStorageSourceChainD { g_autoptr(qemuBlockStorageSourceAttachData) elem = NULL; - if (!(elem = qemuBlockStorageSourceAttachPrepareBlockdev(src, backingStore, true))) + if (!(elem = qemuBlockStorageSourceAttachPrepareBlockdev(src, backingStore))) return -1; if (qemuBuildStorageSourceAttachPrepareCommon(src, elem) < 0) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 76da981d08..ac58aa1a8c 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1045,11 +1045,8 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virDomainObj *vm, tlsAlias, tlsHostname))) return -1; - /* Migration via blockdev-mirror was supported sooner than the auto-read-only - * feature was added to qemu */ if (!(data = qemuBlockStorageSourceAttachPrepareBlockdev(copysrc, - copysrc->backingStore, - false))) + copysrc->backingStore))) return -1; if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_OUT) < 0) -- 2.41.0

'qemuBuildDriveSourceStr' used to build the legacy -drive commandline for SD cards is the only user of qemuDiskSourceGetProps. Move the helper directly inline. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_command.c | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ba21976956..dbef8d0068 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1572,30 +1572,6 @@ qemuDiskBusIsSD(int bus) } -/** - * qemuDiskSourceGetProps: - * @src: disk source struct - * - * Returns the disk source struct wrapped so that it can be used as disk source - * directly by converting it from json. - */ -static virJSONValue * -qemuDiskSourceGetProps(virStorageSource *src) -{ - g_autoptr(virJSONValue) props = NULL; - virJSONValue *ret = NULL; - - if (!(props = qemuBlockStorageSourceGetBackendProps(src, - QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_LEGACY))) - return NULL; - - if (virJSONValueObjectAdd(&ret, "a:file", &props, NULL) < 0) - return NULL; - - return ret; -} - - static int qemuBuildDriveSourceStr(virDomainDiskDef *disk, virBuffer *buf) @@ -1603,7 +1579,6 @@ qemuBuildDriveSourceStr(virDomainDiskDef *disk, virStorageType actualType = virStorageSourceGetActualType(disk->src); qemuDomainStorageSourcePrivate *srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(disk->src); qemuDomainSecretInfo **encinfo = NULL; - g_autoptr(virJSONValue) srcprops = NULL; bool rawluks = false; if (srcpriv) @@ -1624,14 +1599,22 @@ qemuBuildDriveSourceStr(virDomainDiskDef *disk, virQEMUBuildBufferEscapeComma(buf, disk->src->path); break; - case VIR_STORAGE_TYPE_NETWORK: - if (!(srcprops = qemuDiskSourceGetProps(disk->src))) + case VIR_STORAGE_TYPE_NETWORK: { + g_autoptr(virJSONValue) props = NULL; + g_autoptr(virJSONValue) wrap = NULL; + + if (!(props = qemuBlockStorageSourceGetBackendProps(disk->src, + QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_LEGACY))) return -1; - if (virQEMUBuildCommandLineJSON(srcprops, buf, NULL, + if (virJSONValueObjectAdd(&wrap, "a:file", &props, NULL) < 0) + return -1; + + if (virQEMUBuildCommandLineJSON(wrap, buf, NULL, virQEMUBuildCommandLineJSONArrayNumbered) < 0) return -1; break; + } case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: -- 2.41.0

Formatting of the 'nbdkit' driven backend breaks out of the switch statement so we don't need to have an unnecessary block and indentation level for the case when nbdkit is not in use. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 132 +++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index e706bb7369..3be12b47e3 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1028,75 +1028,75 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src, return NULL; case VIR_STORAGE_TYPE_NETWORK: - /* prefer using nbdkit for sources that are supported */ + /* prefer using nbdkit if configured for sources that are supported */ if ((fileprops = qemuBlockStorageSourceGetNbdkitProps(src))) { driver = "nbd"; break; - } else { - switch ((virStorageNetProtocol) src->protocol) { - case VIR_STORAGE_NET_PROTOCOL_GLUSTER: - driver = "gluster"; - if (!(fileprops = qemuBlockStorageSourceGetGlusterProps(src, onlytarget))) - return NULL; - break; - - case VIR_STORAGE_NET_PROTOCOL_VXHS: - driver = "vxhs"; - if (!(fileprops = qemuBlockStorageSourceGetVxHSProps(src, onlytarget))) - return NULL; - break; - - case VIR_STORAGE_NET_PROTOCOL_HTTP: - case VIR_STORAGE_NET_PROTOCOL_HTTPS: - case VIR_STORAGE_NET_PROTOCOL_FTP: - case VIR_STORAGE_NET_PROTOCOL_FTPS: - case VIR_STORAGE_NET_PROTOCOL_TFTP: - driver = virStorageNetProtocolTypeToString(src->protocol); - if (!(fileprops = qemuBlockStorageSourceGetCURLProps(src, onlytarget))) - return NULL; - break; - - case VIR_STORAGE_NET_PROTOCOL_ISCSI: - driver = "iscsi"; - if (!(fileprops = qemuBlockStorageSourceGetISCSIProps(src, onlytarget))) - return NULL; - break; - - case VIR_STORAGE_NET_PROTOCOL_NBD: - driver = "nbd"; - if (!(fileprops = qemuBlockStorageSourceGetNBDProps(src, onlytarget))) - return NULL; - break; - - case VIR_STORAGE_NET_PROTOCOL_RBD: - driver = "rbd"; - if (!(fileprops = qemuBlockStorageSourceGetRBDProps(src, onlytarget))) - return NULL; - break; - - case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG: - driver = "sheepdog"; - if (!(fileprops = qemuBlockStorageSourceGetSheepdogProps(src))) - return NULL; - break; - - case VIR_STORAGE_NET_PROTOCOL_SSH: - driver = "ssh"; - if (!(fileprops = qemuBlockStorageSourceGetSshProps(src))) - return NULL; - break; - - case VIR_STORAGE_NET_PROTOCOL_NFS: - driver = "nfs"; - if (!(fileprops = qemuBlockStorageSourceGetNFSProps(src))) - return NULL; - break; - - case VIR_STORAGE_NET_PROTOCOL_NONE: - case VIR_STORAGE_NET_PROTOCOL_LAST: - virReportEnumRangeError(virStorageNetProtocol, src->protocol); - return NULL; - } + } + + switch ((virStorageNetProtocol) src->protocol) { + case VIR_STORAGE_NET_PROTOCOL_GLUSTER: + driver = "gluster"; + if (!(fileprops = qemuBlockStorageSourceGetGlusterProps(src, onlytarget))) + return NULL; + break; + + case VIR_STORAGE_NET_PROTOCOL_VXHS: + driver = "vxhs"; + if (!(fileprops = qemuBlockStorageSourceGetVxHSProps(src, onlytarget))) + return NULL; + break; + + case VIR_STORAGE_NET_PROTOCOL_HTTP: + case VIR_STORAGE_NET_PROTOCOL_HTTPS: + case VIR_STORAGE_NET_PROTOCOL_FTP: + case VIR_STORAGE_NET_PROTOCOL_FTPS: + case VIR_STORAGE_NET_PROTOCOL_TFTP: + driver = virStorageNetProtocolTypeToString(src->protocol); + if (!(fileprops = qemuBlockStorageSourceGetCURLProps(src, onlytarget))) + return NULL; + break; + + case VIR_STORAGE_NET_PROTOCOL_ISCSI: + driver = "iscsi"; + if (!(fileprops = qemuBlockStorageSourceGetISCSIProps(src, onlytarget))) + return NULL; + break; + + case VIR_STORAGE_NET_PROTOCOL_NBD: + driver = "nbd"; + if (!(fileprops = qemuBlockStorageSourceGetNBDProps(src, onlytarget))) + return NULL; + break; + + case VIR_STORAGE_NET_PROTOCOL_RBD: + driver = "rbd"; + if (!(fileprops = qemuBlockStorageSourceGetRBDProps(src, onlytarget))) + return NULL; + break; + + case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG: + driver = "sheepdog"; + if (!(fileprops = qemuBlockStorageSourceGetSheepdogProps(src))) + return NULL; + break; + + case VIR_STORAGE_NET_PROTOCOL_SSH: + driver = "ssh"; + if (!(fileprops = qemuBlockStorageSourceGetSshProps(src))) + return NULL; + break; + + case VIR_STORAGE_NET_PROTOCOL_NFS: + driver = "nfs"; + if (!(fileprops = qemuBlockStorageSourceGetNFSProps(src))) + return NULL; + break; + + case VIR_STORAGE_NET_PROTOCOL_NONE: + case VIR_STORAGE_NET_PROTOCOL_LAST: + virReportEnumRangeError(virStorageNetProtocol, src->protocol); + return NULL; } break; } -- 2.41.0

Certain disk config fields are mirrored between the disk and storage source definitions. We nee Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/conf/domain_conf.h | 37 ------------------------------------- src/conf/virconftypes.h | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 9e6dd930fa..98f99721f0 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -413,17 +413,6 @@ typedef enum { VIR_DOMAIN_DISK_BUS_LAST } virDomainDiskBus; -typedef enum { - VIR_DOMAIN_DISK_CACHE_DEFAULT, - VIR_DOMAIN_DISK_CACHE_DISABLE, - VIR_DOMAIN_DISK_CACHE_WRITETHRU, - VIR_DOMAIN_DISK_CACHE_WRITEBACK, - VIR_DOMAIN_DISK_CACHE_DIRECTSYNC, - VIR_DOMAIN_DISK_CACHE_UNSAFE, - - VIR_DOMAIN_DISK_CACHE_LAST -} virDomainDiskCache; - typedef enum { VIR_DOMAIN_DISK_ERROR_POLICY_DEFAULT, VIR_DOMAIN_DISK_ERROR_POLICY_STOP, @@ -451,32 +440,6 @@ typedef enum { VIR_DOMAIN_DISK_TRANS_LAST } virDomainDiskGeometryTrans; -typedef enum { - VIR_DOMAIN_DISK_IO_DEFAULT = 0, - VIR_DOMAIN_DISK_IO_NATIVE, - VIR_DOMAIN_DISK_IO_THREADS, - VIR_DOMAIN_DISK_IO_URING, - - VIR_DOMAIN_DISK_IO_LAST -} virDomainDiskIo; - -typedef enum { - VIR_DOMAIN_DISK_DISCARD_DEFAULT = 0, - VIR_DOMAIN_DISK_DISCARD_UNMAP, - VIR_DOMAIN_DISK_DISCARD_IGNORE, - - VIR_DOMAIN_DISK_DISCARD_LAST -} virDomainDiskDiscard; - -typedef enum { - VIR_DOMAIN_DISK_DETECT_ZEROES_DEFAULT = 0, - VIR_DOMAIN_DISK_DETECT_ZEROES_OFF, - VIR_DOMAIN_DISK_DETECT_ZEROES_ON, - VIR_DOMAIN_DISK_DETECT_ZEROES_UNMAP, - - VIR_DOMAIN_DISK_DETECT_ZEROES_LAST -} virDomainDiskDetectZeroes; - typedef enum { VIR_DOMAIN_DISK_MODEL_DEFAULT = 0, VIR_DOMAIN_DISK_MODEL_VIRTIO, diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h index e07f967814..26cb966194 100644 --- a/src/conf/virconftypes.h +++ b/src/conf/virconftypes.h @@ -1,5 +1,5 @@ /* - * virconftypes.h: struct typedefs to avoid circular inclusion + * virconftypes.h: struct and enum type definitions to avoid circular inclusion * * Copyright (C) 2006-2019 Red Hat, Inc. * Copyright (C) 2006-2008 Daniel P. Berrange @@ -261,3 +261,40 @@ typedef struct _virDomainXMLOption virDomainXMLOption; typedef struct _virDomainXMLPrivateDataCallbacks virDomainXMLPrivateDataCallbacks; typedef struct _virDomainXenbusControllerOpts virDomainXenbusControllerOpts; + +typedef enum { + VIR_DOMAIN_DISK_IO_DEFAULT = 0, + VIR_DOMAIN_DISK_IO_NATIVE, + VIR_DOMAIN_DISK_IO_THREADS, + VIR_DOMAIN_DISK_IO_URING, + + VIR_DOMAIN_DISK_IO_LAST +} virDomainDiskIo; + +typedef enum { + VIR_DOMAIN_DISK_CACHE_DEFAULT = 0, + VIR_DOMAIN_DISK_CACHE_DISABLE, + VIR_DOMAIN_DISK_CACHE_WRITETHRU, + VIR_DOMAIN_DISK_CACHE_WRITEBACK, + VIR_DOMAIN_DISK_CACHE_DIRECTSYNC, + VIR_DOMAIN_DISK_CACHE_UNSAFE, + + VIR_DOMAIN_DISK_CACHE_LAST +} virDomainDiskCache; + +typedef enum { + VIR_DOMAIN_DISK_DISCARD_DEFAULT = 0, + VIR_DOMAIN_DISK_DISCARD_UNMAP, + VIR_DOMAIN_DISK_DISCARD_IGNORE, + + VIR_DOMAIN_DISK_DISCARD_LAST +} virDomainDiskDiscard; + +typedef enum { + VIR_DOMAIN_DISK_DETECT_ZEROES_DEFAULT = 0, + VIR_DOMAIN_DISK_DETECT_ZEROES_OFF, + VIR_DOMAIN_DISK_DETECT_ZEROES_ON, + VIR_DOMAIN_DISK_DETECT_ZEROES_UNMAP, + + VIR_DOMAIN_DISK_DETECT_ZEROES_LAST +} virDomainDiskDetectZeroes; -- 2.41.0

On a Wednesday in 2023, Peter Krempa wrote:
Certain disk config fields are mirrored between the disk and storage source definitions. We nee
Do we?
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/conf/domain_conf.h | 37 ------------------------------------- src/conf/virconftypes.h | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 38 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

The aforementioned fields in virStorageSource struct are copies of the disk properties, but were not converted to the proper type yet. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/conf/storage_source_conf.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index 2db780611e..5e7d127453 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -397,10 +397,10 @@ struct _virStorageSource { /* Libvirt currently stores the following properties in virDomainDiskDef. * These instances are currently just copies from the parent definition and * are not mapped back to the XML */ - int iomode; /* enum virDomainDiskIo */ - int cachemode; /* enum virDomainDiskCache */ - int discard; /* enum virDomainDiskDiscard */ - int detect_zeroes; /* enum virDomainDiskDetectZeroes */ + virDomainDiskIo iomode; + virDomainDiskCache cachemode; + virDomainDiskDiscard discard; + virDomainDiskDetectZeroes detect_zeroes; virTristateSwitch discard_no_unref; bool floppyimg; /* set to true if the storage source is going to be used -- 2.41.0

Return whether a relevant cachemode was presented rather than returning an error, so that callers can be simplified. Use the proper enum type as argument rather than typecasting in the switch statement. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 5 +---- src/qemu/qemu_command.c | 15 ++++++--------- src/qemu/qemu_domain.c | 31 +++++++++++++++++-------------- src/qemu/qemu_domain.h | 4 ++-- 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 3be12b47e3..0f47b5b37f 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -919,12 +919,9 @@ qemuBlockStorageSourceGetBlockdevGetCacheProps(virStorageSource *src, bool direct = false; bool noflush = false; - if (src->cachemode == VIR_DOMAIN_DISK_CACHE_DEFAULT) + if (!qemuDomainDiskCachemodeFlags(src->cachemode, NULL, &direct, &noflush)) return 0; - if (qemuDomainDiskCachemodeFlags(src->cachemode, NULL, &direct, &noflush) < 0) - return -1; - if (virJSONValueObjectAdd(&cacheobj, "b:direct", direct, "b:no-flush", noflush, diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index dbef8d0068..fd0f12f304 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1889,16 +1889,13 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, wwn = virJSONValueNewNumberUlong(w); } - if (disk->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) { - /* VIR_DOMAIN_DISK_DEVICE_LUN translates into 'scsi-block' - * where any caching setting makes no sense. */ - if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN) { - bool wb; - - if (qemuDomainDiskCachemodeFlags(disk->cachemode, &wb, NULL, - NULL) < 0) - return NULL; + /* 'write-cache' component of disk->cachemode is set on device level. + * VIR_DOMAIN_DISK_DEVICE_LUN translates into 'scsi-block' where any + * caching setting makes no sense. */ + if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN) { + bool wb; + if (qemuDomainDiskCachemodeFlags(disk->cachemode, &wb, NULL, NULL)) { writeCache = virTristateSwitchFromBool(wb); } } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 995aa3f79c..0b36a49bdf 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11406,13 +11406,18 @@ qemuDomainPrepareHostdev(virDomainHostdevDef *hostdev, /** * qemuDomainDiskCachemodeFlags: + * @cachemode: aggregated cache mode + * @writeback: populated with 'writeback' component of @cachemode (may be NULL) + * @direct: populated with 'direct' component of @cachemode (may be NULL) + * @noflush: populated with 'noflush' component of @cachemode (may be NULL) * - * Converts disk cachemode to the cache mode options for qemu. Returns -1 for - * invalid @cachemode values and fills the flags and returns 0 on success. - * Flags may be NULL. + * Converts disk @cachemode to the cache mode options for qemu according to the + * table below. + * + * Returns true if @cachemode is a relevant cache mode setting. */ -int -qemuDomainDiskCachemodeFlags(int cachemode, +bool +qemuDomainDiskCachemodeFlags(virDomainDiskCache cachemode, bool *writeback, bool *direct, bool *noflush) @@ -11442,40 +11447,38 @@ qemuDomainDiskCachemodeFlags(int cachemode, *writeback = true; *direct = true; *noflush = false; - break; + return true; case VIR_DOMAIN_DISK_CACHE_WRITETHRU: *writeback = false; *direct = false; *noflush = false; - break; + return true; case VIR_DOMAIN_DISK_CACHE_WRITEBACK: *writeback = true; *direct = false; *noflush = false; - break; + return true; case VIR_DOMAIN_DISK_CACHE_DIRECTSYNC: *writeback = false; *direct = true; *noflush = false; - break; + return true; case VIR_DOMAIN_DISK_CACHE_UNSAFE: *writeback = true; *direct = false; *noflush = true; - break; + return true; case VIR_DOMAIN_DISK_CACHE_DEFAULT: case VIR_DOMAIN_DISK_CACHE_LAST: - default: - virReportEnumRangeError(virDomainDiskCache, cachemode); - return -1; + return false; } - return 0; + return false; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index a3fc6acaaa..1e56e50672 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1008,8 +1008,8 @@ qemuDomainPrepareDiskSource(virDomainDiskDef *disk, qemuDomainObjPrivate *priv, virQEMUDriverConfig *cfg); -int -qemuDomainDiskCachemodeFlags(int cachemode, +bool +qemuDomainDiskCachemodeFlags(virDomainDiskCache cachemode, bool *writeback, bool *direct, bool *noflush); -- 2.41.0

Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 29 ++++++++++++++++------------- src/qemu/qemu_domain.c | 2 +- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 0f47b5b37f..41038fb994 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -913,24 +913,20 @@ qemuBlockStorageSourceGetVhostVdpaProps(virStorageSource *src) static int qemuBlockStorageSourceGetBlockdevGetCacheProps(virStorageSource *src, - virJSONValue *props) + virJSONValue **cache) { - g_autoptr(virJSONValue) cacheobj = NULL; bool direct = false; bool noflush = false; if (!qemuDomainDiskCachemodeFlags(src->cachemode, NULL, &direct, &noflush)) return 0; - if (virJSONValueObjectAdd(&cacheobj, + if (virJSONValueObjectAdd(cache, "b:direct", direct, "b:no-flush", noflush, NULL) < 0) return -1; - if (virJSONValueObjectAppend(props, "cache", &cacheobj) < 0) - return -1; - return 0; } @@ -1109,10 +1105,13 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src, return NULL; if (!legacy) { - if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, fileprops) < 0) + g_autoptr(virJSONValue) cache = NULL; + + if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0) return NULL; if (virJSONValueObjectAdd(&fileprops, + "A:cache", &cache, "T:read-only", ro, "T:auto-read-only", aro, NULL) < 0) @@ -1278,10 +1277,14 @@ qemuBlockStorageSourceGetBlockdevFormatCommonProps(virStorageSource *src) int detectZeroesMode = virDomainDiskGetDetectZeroesMode(src->discard, src->detect_zeroes); g_autoptr(virJSONValue) props = NULL; + g_autoptr(virJSONValue) cache = NULL; if (qemuBlockNodeNameValidate(qemuBlockStorageSourceGetFormatNodename(src)) < 0) return NULL; + if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0) + return NULL; + if (src->discard) discard = virDomainDiskDiscardTypeToString(src->discard); @@ -1297,12 +1300,10 @@ qemuBlockStorageSourceGetBlockdevFormatCommonProps(virStorageSource *src) "b:read-only", src->readonly, "S:discard", discard, "S:detect-zeroes", detectZeroes, + "A:cache", &cache, NULL) < 0) return NULL; - if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, props) < 0) - return NULL; - return g_steal_pointer(&props); } @@ -1439,10 +1440,14 @@ static virJSONValue * qemuBlockStorageSourceGetBlockdevStorageSliceProps(virStorageSource *src) { g_autoptr(virJSONValue) props = NULL; + g_autoptr(virJSONValue) cache = NULL; if (qemuBlockNodeNameValidate(src->sliceStorage->nodename) < 0) return NULL; + if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0) + return NULL; + if (virJSONValueObjectAdd(&props, "s:driver", "raw", "s:node-name", src->sliceStorage->nodename, @@ -1451,12 +1456,10 @@ qemuBlockStorageSourceGetBlockdevStorageSliceProps(virStorageSource *src) "s:file", qemuBlockStorageSourceGetStorageNodename(src), "b:auto-read-only", true, "s:discard", "unmap", + "A:cache", &cache, NULL) < 0) return NULL; - if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, props) < 0) - return NULL; - return g_steal_pointer(&props); } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0b36a49bdf..ae19ce884b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11442,7 +11442,7 @@ qemuDomainDiskCachemodeFlags(virDomainDiskCache cachemode, * directsync │ false true false * unsafe │ true false true */ - switch ((virDomainDiskCache) cachemode) { + switch (cachemode) { case VIR_DOMAIN_DISK_CACHE_DISABLE: /* 'none' */ *writeback = true; *direct = true; -- 2.41.0

On a Wednesday in 2023, Peter Krempa wrote:
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 29 ++++++++++++++++------------- src/qemu/qemu_domain.c | 2 +- 2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0b36a49bdf..ae19ce884b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11442,7 +11442,7 @@ qemuDomainDiskCachemodeFlags(virDomainDiskCache cachemode, * directsync ??? false true false * unsafe ??? true false true */ - switch ((virDomainDiskCache) cachemode) { + switch (cachemode) {
This change looks unrelated.
case VIR_DOMAIN_DISK_CACHE_DISABLE: /* 'none' */ *writeback = true; *direct = true;
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Both tests pass a disk source definition which didn't go through the preparation steps and thus contains only the target information that were originally present, thus we should be using the QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY flag. For the same reason QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY used in 'testJSONtoJSON' doesn't make sense. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemublocktest.c | 4 ++-- tests/qemublocktestdata/jsontojson/curl-libguestfs-out.json | 5 ++--- .../jsontojson/ssh-passthrough-libguestfs-out.json | 4 +--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index addd646071..ce76150200 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -59,7 +59,7 @@ testBackingXMLjsonXML(const void *args) g_autoptr(virStorageSource) xmlsrc = NULL; g_autoptr(virStorageSource) jsonsrc = NULL; g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER; - unsigned int backendpropsflags = 0; + unsigned int backendpropsflags = QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY; if (data->legacy) backendpropsflags |= QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_LEGACY; @@ -157,7 +157,7 @@ testJSONtoJSON(const void *args) } if (!(jsonsrcout = qemuBlockStorageSourceGetBackendProps(src, - QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY))) { + QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY))) { fprintf(stderr, "failed to format disk source json\n"); return -1; } diff --git a/tests/qemublocktestdata/jsontojson/curl-libguestfs-out.json b/tests/qemublocktestdata/jsontojson/curl-libguestfs-out.json index e130c7bd3c..8cfacb5bc8 100644 --- a/tests/qemublocktestdata/jsontojson/curl-libguestfs-out.json +++ b/tests/qemublocktestdata/jsontojson/curl-libguestfs-out.json @@ -2,8 +2,7 @@ "driver": "https", "url": "https://test.host:443/whatever.img", "sslverify": false, + "cookie": "some_cookie=\"some_value_or_whatever\"", "timeout": 2000, - "readahead": 65536, - "auto-read-only": true, - "discard": "unmap" + "readahead": 65536 } diff --git a/tests/qemublocktestdata/jsontojson/ssh-passthrough-libguestfs-out.json b/tests/qemublocktestdata/jsontojson/ssh-passthrough-libguestfs-out.json index 1f6032deb4..7855917e2e 100644 --- a/tests/qemublocktestdata/jsontojson/ssh-passthrough-libguestfs-out.json +++ b/tests/qemublocktestdata/jsontojson/ssh-passthrough-libguestfs-out.json @@ -8,7 +8,5 @@ "user": "testuser", "host-key-check": { "mode": "none" - }, - "auto-read-only": true, - "discard": "unmap" + } } -- 2.41.0

On a Wednesday in 2023, Peter Krempa wrote:
Both tests pass a disk source definition which didn't go through the preparation steps and thus contains only the target information that were originally present, thus we should be using the QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY flag.
For the same reason QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY used in 'testJSONtoJSON' doesn't make sense.
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemublocktest.c | 4 ++-- tests/qemublocktestdata/jsontojson/curl-libguestfs-out.json | 5 ++--- .../jsontojson/ssh-passthrough-libguestfs-out.json | 4 +--- 3 files changed, 5 insertions(+), 8 deletions(-)
For patches 1 to 9/22 Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

QEMU deprecated and removed support for those protocols, but due to a logic bug in the tests it was not caught. Remove the test cases first. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemublocktest.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index ce76150200..a89dddf002 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -1084,12 +1084,6 @@ mymain(void) TEST_JSON_FORMAT_NET("<source protocol='iscsi' name='iqn.2016-12.com.virttest:emulated-iscsi-noauth.target/6'>\n" " <host name='test.org' port='1234'/>\n" "</source>\n"); - TEST_JSON_FORMAT_NET("<source protocol='sheepdog' name='test'>\n" - " <host name='example.com' port='321'/>\n" - "</source>\n"); - TEST_JSON_FORMAT_NET("<source protocol='vxhs' name='c6718f6b-0401-441d-a8c3-1f0064d75ee0'>\n" - " <host name='example.com' port='9999'/>\n" - "</source>\n"); #define TEST_DISK_TO_JSON_FULL(nme, fl) \ do { \ -- 2.41.0

Condition handling failure of the first virTestRun was lacking the 'ret = -1' line thus the subsequent line was taken as it's body rendering the first invocation useless. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemublocktest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index a89dddf002..161fd84871 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -1015,6 +1015,7 @@ mymain(void) xmljsonxmldata.legacy = true; \ if (virTestRun(virTestCounterNext(), testBackingXMLjsonXML, \ &xmljsonxmldata) < 0) \ + ret = -1; \ xmljsonxmldata.legacy = false; \ if (virTestRun(virTestCounterNext(), testBackingXMLjsonXML, \ &xmljsonxmldata) < 0) \ -- 2.41.0

Legacy mode used to be needed for use with -drive, which was almost completely deleted. We now have qemuxml2argvtest test cases checking a few cases and the rest uses the modern mode only. Thus we don't need to test the legacy mode any more. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemublocktest.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 161fd84871..b8db1a2570 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -61,8 +61,6 @@ testBackingXMLjsonXML(const void *args) g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER; unsigned int backendpropsflags = QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY; - if (data->legacy) - backendpropsflags |= QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_LEGACY; xmlsrc = virStorageSourceNew(); xmlsrc->type = data->type; @@ -81,17 +79,15 @@ testBackingXMLjsonXML(const void *args) return -1; } - if (!data->legacy) { - if (testQEMUSchemaValidate(backendprops, data->schemaroot, - data->schema, false, &debug) < 0) { - g_autofree char *debugmsg = virBufferContentAndReset(&debug); - g_autofree char *debugprops = virJSONValueToString(backendprops, true); + if (testQEMUSchemaValidate(backendprops, data->schemaroot, + data->schema, false, &debug) < 0) { + g_autofree char *debugmsg = virBufferContentAndReset(&debug); + g_autofree char *debugprops = virJSONValueToString(backendprops, true); - VIR_TEST_VERBOSE("json does not conform to QAPI schema"); - VIR_TEST_DEBUG("json:\n%s\ndoes not match schema. Debug output:\n %s", - debugprops, NULLSTR(debugmsg)); - return -1; - } + VIR_TEST_VERBOSE("json does not conform to QAPI schema"); + VIR_TEST_DEBUG("json:\n%s\ndoes not match schema. Debug output:\n %s", + debugprops, NULLSTR(debugmsg)); + return -1; } if (virJSONValueObjectAdd(&wrapper, "a:file", &backendprops, NULL) < 0) @@ -1012,11 +1008,6 @@ mymain(void) do { \ xmljsonxmldata.type = tpe; \ xmljsonxmldata.xml = xmlstr; \ - xmljsonxmldata.legacy = true; \ - if (virTestRun(virTestCounterNext(), testBackingXMLjsonXML, \ - &xmljsonxmldata) < 0) \ - ret = -1; \ - xmljsonxmldata.legacy = false; \ if (virTestRun(virTestCounterNext(), testBackingXMLjsonXML, \ &xmljsonxmldata) < 0) \ ret = -1; \ -- 2.41.0

At this point only a single code path (for formatting -drive for legacy SD cards) uses the 'legacy' output and that code path doesn't populate the node name. Thus we can unify the code block and simplify the JSON formatters. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 41038fb994..ca68b9ab66 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1097,32 +1097,28 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src, if (driver && virJSONValueObjectPrependString(fileprops, "driver", driver) < 0) return NULL; - if (!onlytarget) { - if (qemuBlockNodeNameValidate(qemuBlockStorageSourceGetStorageNodename(src)) < 0 || - virJSONValueObjectAdd(&fileprops, - "S:node-name", qemuBlockStorageSourceGetStorageNodename(src), - NULL) < 0) - return NULL; + if (!onlytarget && !legacy) { + g_autoptr(virJSONValue) cache = NULL; + const char *discardstr = "unmap"; + const char *nodename = qemuBlockStorageSourceGetStorageNodename(src); - if (!legacy) { - g_autoptr(virJSONValue) cache = NULL; + if (flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP) + discardstr = NULL; - if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0) - return NULL; + if (qemuBlockNodeNameValidate(nodename) < 0) + return NULL; - if (virJSONValueObjectAdd(&fileprops, - "A:cache", &cache, - "T:read-only", ro, - "T:auto-read-only", aro, - NULL) < 0) - return NULL; + if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0) + return NULL; - if (!(flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP) && - virJSONValueObjectAdd(&fileprops, - "s:discard", "unmap", - NULL) < 0) - return NULL; - } + if (virJSONValueObjectAdd(&fileprops, + "s:node-name", nodename, + "A:cache", &cache, + "T:read-only", ro, + "T:auto-read-only", aro, + "S:discard", discardstr, + NULL) < 0) + return NULL; } return g_steal_pointer(&fileprops); -- 2.41.0

Change the return value type to 'virDomainDiskGetDetectZeroes'. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 2 +- src/qemu/qemu_block.c | 4 ++-- src/qemu/qemu_command.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 80f467ae7a..fa97def9f7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30592,7 +30592,7 @@ virDomainDiskTranslateSourcePool(virDomainDiskDef *def) * don't change it in the XML for easier adjustments. This behaviour is * documented. */ -int +virDomainDiskDetectZeroes virDomainDiskGetDetectZeroesMode(virDomainDiskDiscard discard, virDomainDiskDetectZeroes detect_zeroes) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 98f99721f0..7c0e017038 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -4406,7 +4406,7 @@ virDomainNetResolveActualType(virDomainNetDef *iface) int virDomainDiskTranslateSourcePool(virDomainDiskDef *def); -int +virDomainDiskDetectZeroes virDomainDiskGetDetectZeroesMode(virDomainDiskDiscard discard, virDomainDiskDetectZeroes detect_zeroes); diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index ca68b9ab66..1fa9627444 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1270,8 +1270,8 @@ qemuBlockStorageSourceGetBlockdevFormatCommonProps(virStorageSource *src) { const char *detectZeroes = NULL; const char *discard = NULL; - int detectZeroesMode = virDomainDiskGetDetectZeroesMode(src->discard, - src->detect_zeroes); + virDomainDiskDetectZeroes detectZeroesMode = virDomainDiskGetDetectZeroesMode(src->discard, + src->detect_zeroes); g_autoptr(virJSONValue) props = NULL; g_autoptr(virJSONValue) cache = NULL; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index fd0f12f304..98e7fa3d80 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1680,8 +1680,8 @@ static char * qemuBuildDriveStr(virDomainDiskDef *disk) { g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER; - int detect_zeroes = virDomainDiskGetDetectZeroesMode(disk->discard, - disk->detect_zeroes); + virDomainDiskDetectZeroes detect_zeroes = virDomainDiskGetDetectZeroesMode(disk->discard, + disk->detect_zeroes); if (qemuBuildDriveSourceStr(disk, &opt) < 0) return NULL; -- 2.41.0

Use the same ordering of the relevant fields as we do for the format layer -blockdev so that later they can be refactored without test fallout. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 2 +- .../xml2json/dir-fat-cache.json | 6 ++--- .../file-backing_basic-cache-directsync.json | 24 +++++++++---------- .../file-backing_basic-cache-none.json | 24 +++++++++---------- .../file-backing_basic-cache-unsafe.json | 24 +++++++++---------- .../file-backing_basic-cache-writeback.json | 24 +++++++++---------- ...file-backing_basic-cache-writethrough.json | 24 +++++++++---------- .../xml2json/file-raw-aio_native.json | 6 ++--- ...work-qcow2-backing-chain-cache-unsafe.json | 12 +++++----- .../blkdeviotune-group-num.x86_64-latest.args | 4 ++-- ...blkdeviotune-max-length.x86_64-latest.args | 4 ++-- .../blkdeviotune-max.x86_64-latest.args | 4 ++-- .../blkdeviotune.x86_64-latest.args | 4 ++-- .../controller-order.x86_64-latest.args | 2 +- .../disk-aio.x86_64-latest.args | 2 +- .../disk-cache.x86_64-latest.args | 10 ++++---- .../disk-error-policy-s390x.s390x-latest.args | 6 ++--- .../disk-error-policy.x86_64-latest.args | 6 ++--- .../disk-metadata-cache.x86_64-latest.args | 6 ++--- .../disk-network-nfs.x86_64-latest.args | 2 +- ...rk-tlsx509-nbd-hostname.x86_64-latest.args | 2 +- ...disk-network-tlsx509-nbd.x86_64-5.2.0.args | 2 +- ...isk-network-tlsx509-nbd.x86_64-latest.args | 2 +- ...isk-network-tlsx509-vxhs.x86_64-5.0.0.args | 6 ++--- .../disk-nvme.x86_64-latest.args | 2 +- .../disk-shared.x86_64-latest.args | 6 ++--- .../disk-slices.x86_64-latest.args | 2 +- .../disk-snapshot.x86_64-latest.args | 4 ++-- .../disk-transient.x86_64-latest.args | 2 +- .../disk-vhostvdpa.x86_64-latest.args | 2 +- .../name-escape.x86_64-latest.args | 2 +- .../user-aliases.x86_64-latest.args | 4 ++-- ...eo-bochs-display-device.x86_64-latest.args | 2 +- ...-device-pciaddr-default.x86_64-latest.args | 2 +- ...video-qxl-device-vgamem.x86_64-latest.args | 2 +- .../video-qxl-device.x86_64-latest.args | 2 +- ...o-qxl-sec-device-vgamem.x86_64-latest.args | 2 +- .../video-qxl-sec-device.x86_64-latest.args | 2 +- ...eo-ramfb-display-device.x86_64-latest.args | 2 +- ...video-vga-device-vgamem.x86_64-latest.args | 2 +- .../video-vga-device.x86_64-latest.args | 2 +- .../video-virtio-blob-off.x86_64-latest.args | 2 +- .../video-virtio-blob-on.x86_64-latest.args | 2 +- ...video-virtio-gpu-device.x86_64-latest.args | 2 +- ...video-virtio-gpu-sdl-gl.x86_64-latest.args | 2 +- ...deo-virtio-gpu-spice-gl.x86_64-latest.args | 2 +- .../video-virtio-gpu-virgl.x86_64-latest.args | 2 +- .../video-virtio-vga.x86_64-latest.args | 2 +- 48 files changed, 132 insertions(+), 132 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 1fa9627444..689eb535cb 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1113,10 +1113,10 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src, if (virJSONValueObjectAdd(&fileprops, "s:node-name", nodename, - "A:cache", &cache, "T:read-only", ro, "T:auto-read-only", aro, "S:discard", discardstr, + "A:cache", &cache, NULL) < 0) return NULL; } diff --git a/tests/qemublocktestdata/xml2json/dir-fat-cache.json b/tests/qemublocktestdata/xml2json/dir-fat-cache.json index 2a24175ef4..320dc77de1 100644 --- a/tests/qemublocktestdata/xml2json/dir-fat-cache.json +++ b/tests/qemublocktestdata/xml2json/dir-fat-cache.json @@ -14,10 +14,10 @@ "floppy": false, "rw": false, "node-name": "node-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": true, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.json index 1d5ae09813..7a8d0686f6 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.json @@ -13,12 +13,12 @@ "driver": "file", "filename": "/var/lib/libvirt/images/a", "node-name": "node-a-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": true, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-b-f", @@ -35,12 +35,12 @@ "driver": "file", "filename": "/var/lib/libvirt/images/b", "node-name": "node-b-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": true, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-c-f", @@ -65,12 +65,12 @@ } ], "node-name": "node-c-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": true, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-d-f", @@ -86,10 +86,10 @@ "driver": "file", "filename": "/var/lib/libvirt/images/d", "node-name": "node-d-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": true, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json index 1d5ae09813..7a8d0686f6 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json @@ -13,12 +13,12 @@ "driver": "file", "filename": "/var/lib/libvirt/images/a", "node-name": "node-a-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": true, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-b-f", @@ -35,12 +35,12 @@ "driver": "file", "filename": "/var/lib/libvirt/images/b", "node-name": "node-b-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": true, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-c-f", @@ -65,12 +65,12 @@ } ], "node-name": "node-c-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": true, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-d-f", @@ -86,10 +86,10 @@ "driver": "file", "filename": "/var/lib/libvirt/images/d", "node-name": "node-d-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": true, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json index 4afd7366cf..15c8293f63 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json @@ -13,12 +13,12 @@ "driver": "file", "filename": "/var/lib/libvirt/images/a", "node-name": "node-a-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": true - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-b-f", @@ -35,12 +35,12 @@ "driver": "file", "filename": "/var/lib/libvirt/images/b", "node-name": "node-b-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": true - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-c-f", @@ -65,12 +65,12 @@ } ], "node-name": "node-c-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": true - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-d-f", @@ -86,10 +86,10 @@ "driver": "file", "filename": "/var/lib/libvirt/images/d", "node-name": "node-d-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": true - }, - "auto-read-only": true, - "discard": "unmap" + } } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.json index 9ed806eb04..5918eed73f 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.json @@ -13,12 +13,12 @@ "driver": "file", "filename": "/var/lib/libvirt/images/a", "node-name": "node-a-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-b-f", @@ -35,12 +35,12 @@ "driver": "file", "filename": "/var/lib/libvirt/images/b", "node-name": "node-b-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-c-f", @@ -65,12 +65,12 @@ } ], "node-name": "node-c-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-d-f", @@ -86,10 +86,10 @@ "driver": "file", "filename": "/var/lib/libvirt/images/d", "node-name": "node-d-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethrough.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethrough.json index 9ed806eb04..5918eed73f 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethrough.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethrough.json @@ -13,12 +13,12 @@ "driver": "file", "filename": "/var/lib/libvirt/images/a", "node-name": "node-a-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-b-f", @@ -35,12 +35,12 @@ "driver": "file", "filename": "/var/lib/libvirt/images/b", "node-name": "node-b-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-c-f", @@ -65,12 +65,12 @@ } ], "node-name": "node-c-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-d-f", @@ -86,10 +86,10 @@ "driver": "file", "filename": "/var/lib/libvirt/images/d", "node-name": "node-d-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } diff --git a/tests/qemublocktestdata/xml2json/file-raw-aio_native.json b/tests/qemublocktestdata/xml2json/file-raw-aio_native.json index 1ae76895cd..1359c98986 100644 --- a/tests/qemublocktestdata/xml2json/file-raw-aio_native.json +++ b/tests/qemublocktestdata/xml2json/file-raw-aio_native.json @@ -13,10 +13,10 @@ "filename": "/path/to/i.img", "aio": "native", "node-name": "test2", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": true, "no-flush": false - }, - "auto-read-only": true, - "discard": "unmap" + } } diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe.json b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe.json index 9ee18dba51..d270f15f68 100644 --- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe.json +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe.json @@ -30,12 +30,12 @@ ], "key-secret": "node-a-s-secalias", "node-name": "node-a-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": true - }, - "auto-read-only": true, - "discard": "unmap" + } } { "node-name": "node-b-f", @@ -55,10 +55,10 @@ "lun": 1, "transport": "tcp", "node-name": "node-b-s", + "auto-read-only": true, + "discard": "unmap", "cache": { "direct": false, "no-flush": true - }, - "auto-read-only": true, - "discard": "unmap" + } } diff --git a/tests/qemuxml2argvdata/blkdeviotune-group-num.x86_64-latest.args b/tests/qemuxml2argvdata/blkdeviotune-group-num.x86_64-latest.args index 925c393d4b..38d38734f5 100644 --- a/tests/qemuxml2argvdata/blkdeviotune-group-num.x86_64-latest.args +++ b/tests/qemuxml2argvdata/blkdeviotune-group-num.x86_64-latest.args @@ -27,10 +27,10 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-2-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-2-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":1,"drive":"libvirt-1-format","id":"ide0-0-1","write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/blkdeviotune-max-length.x86_64-latest.args b/tests/qemuxml2argvdata/blkdeviotune-max-length.x86_64-latest.args index 925c393d4b..38d38734f5 100644 --- a/tests/qemuxml2argvdata/blkdeviotune-max-length.x86_64-latest.args +++ b/tests/qemuxml2argvdata/blkdeviotune-max-length.x86_64-latest.args @@ -27,10 +27,10 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-2-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-2-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":1,"drive":"libvirt-1-format","id":"ide0-0-1","write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/blkdeviotune-max.x86_64-latest.args b/tests/qemuxml2argvdata/blkdeviotune-max.x86_64-latest.args index 925c393d4b..38d38734f5 100644 --- a/tests/qemuxml2argvdata/blkdeviotune-max.x86_64-latest.args +++ b/tests/qemuxml2argvdata/blkdeviotune-max.x86_64-latest.args @@ -27,10 +27,10 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-2-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-2-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":1,"drive":"libvirt-1-format","id":"ide0-0-1","write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/blkdeviotune.x86_64-latest.args b/tests/qemuxml2argvdata/blkdeviotune.x86_64-latest.args index 1300201889..7a2f740309 100644 --- a/tests/qemuxml2argvdata/blkdeviotune.x86_64-latest.args +++ b/tests/qemuxml2argvdata/blkdeviotune.x86_64-latest.args @@ -27,10 +27,10 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-2-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-2-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":1,"drive":"libvirt-1-format","id":"ide0-0-1","write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/controller-order.x86_64-latest.args b/tests/qemuxml2argvdata/controller-order.x86_64-latest.args index 884e651b8e..d01831aaa6 100644 --- a/tests/qemuxml2argvdata/controller-order.x86_64-latest.args +++ b/tests/qemuxml2argvdata/controller-order.x86_64-latest.args @@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-fdr/.config \ -device '{"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.0","addr":"0x7"}' \ -device '{"driver":"usb-hub","id":"hub0","bus":"usb.0","port":"1"}' \ -device '{"driver":"usb-ccid","id":"ccid0","bus":"usb.0","port":"1.1"}' \ --blockdev '{"driver":"file","filename":"/tmp/fdr.img","aio":"native","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/tmp/fdr.img","aio":"native","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-2-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x5","share-rw":true,"drive":"libvirt-2-format","id":"virtio-disk0","bootindex":1,"write-cache":"on"}' \ -blockdev '{"driver":"file","filename":"/tmp/Fedora-17-x86_64-Live-Desktop.iso","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ diff --git a/tests/qemuxml2argvdata/disk-aio.x86_64-latest.args b/tests/qemuxml2argvdata/disk-aio.x86_64-latest.args index 6e40786047..caf6f6eac6 100644 --- a/tests/qemuxml2argvdata/disk-aio.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-aio.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","aio":"native","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","aio":"native","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-2-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-2-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","aio":"threads","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ diff --git a/tests/qemuxml2argvdata/disk-cache.x86_64-latest.args b/tests/qemuxml2argvdata/disk-cache.x86_64-latest.args index f094c6c7fb..27be644177 100644 --- a/tests/qemuxml2argvdata/disk-cache.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-cache.x86_64-latest.args @@ -28,19 +28,19 @@ 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":"lsi","id":"scsi0","bus":"pci.0","addr":"0x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-5-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":false,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-5-format","read-only":false,"cache":{"direct":false,"no-flush":false},"driver":"qcow2","file":"libvirt-5-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-5-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-4-storage","cache":{"direct":false,"no-flush":true},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":false,"no-flush":true}}' \ -blockdev '{"node-name":"libvirt-4-format","read-only":false,"cache":{"direct":false,"no-flush":true},"driver":"qcow2","file":"libvirt-4-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":1,"drive":"libvirt-4-format","id":"ide0-0-1","write-cache":"on"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-3-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-3-storage"}' \ -device '{"driver":"scsi-hd","bus":"scsi0.0","scsi-id":0,"device_id":"drive-scsi0-0-0","drive":"libvirt-3-format","id":"scsi0-0-0","write-cache":"on"}' \ --blockdev '{"driver":"host_device","filename":"/dev/disk/by-path/ip-192.168.44.1:3260-iscsi-iqn.2011-02.lan.hdserver:hydrar-desktop.win7vm-lun-0","node-name":"libvirt-2-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/disk/by-path/ip-192.168.44.1:3260-iscsi-iqn.2011-02.lan.hdserver:hydrar-desktop.win7vm-lun-0","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":false,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":false,"no-flush":false},"driver":"qcow2","file":"libvirt-2-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-2-format","id":"virtio-disk0","write-cache":"off"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"usb-storage","bus":"usb.0","port":"1","drive":"libvirt-1-format","id":"usb-disk1","removable":false,"write-cache":"off"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args b/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args index c023ff8903..4ca56d2265 100644 --- a/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args +++ b/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args @@ -26,13 +26,13 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --blockdev '{"driver":"file","filename":"/var/images/image1","node-name":"libvirt-3-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/images/image1","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-3-storage"}' \ -device '{"driver":"virtio-blk-ccw","devno":"fe.0.0000","drive":"libvirt-3-format","id":"virtio-disk0","bootindex":1,"write-cache":"on","werror":"stop","rerror":"stop"}' \ --blockdev '{"driver":"file","filename":"/var/images/image2","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/images/image2","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-2-storage"}' \ -device '{"driver":"virtio-blk-ccw","devno":"fe.0.0001","drive":"libvirt-2-format","id":"virtio-disk1","write-cache":"on","werror":"enospc"}' \ --blockdev '{"driver":"file","filename":"/var/images/image3","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/images/image3","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"virtio-blk-ccw","devno":"fe.0.0002","drive":"libvirt-1-format","id":"virtio-disk2","write-cache":"on","werror":"report","rerror":"ignore"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/disk-error-policy.x86_64-latest.args b/tests/qemuxml2argvdata/disk-error-policy.x86_64-latest.args index 4599ddbae1..e1018fb2d6 100644 --- a/tests/qemuxml2argvdata/disk-error-policy.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-error-policy.x86_64-latest.args @@ -27,13 +27,13 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-3-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-3-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-3-format","id":"ide0-0-0","bootindex":1,"write-cache":"on","werror":"stop","rerror":"stop"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-2-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":1,"drive":"libvirt-2-format","id":"ide0-0-1","write-cache":"on","werror":"enospc"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest3","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest3","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.1","unit":0,"drive":"libvirt-1-format","id":"ide0-1-0","write-cache":"on","werror":"report","rerror":"ignore"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/disk-metadata-cache.x86_64-latest.args b/tests/qemuxml2argvdata/disk-metadata-cache.x86_64-latest.args index acac58ca1c..9bb47e59ed 100644 --- a/tests/qemuxml2argvdata/disk-metadata-cache.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-metadata-cache.x86_64-latest.args @@ -27,12 +27,12 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/tmp/QEMUGuest1.img","node-name":"libvirt-3-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/tmp/QEMUGuest1.img","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","cache-size":12345,"file":"libvirt-3-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-3-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ --blockdev '{"driver":"file","filename":"/tmp/backing-store.qcow","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/tmp/backing-store.qcow","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":true,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","cache-size":1048576,"file":"libvirt-2-storage","backing":null}' \ --blockdev '{"driver":"file","filename":"/tmp/QEMUGuest2.img","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/tmp/QEMUGuest2.img","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage","backing":"libvirt-2-format"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":1,"drive":"libvirt-1-format","id":"ide0-0-1","write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/disk-network-nfs.x86_64-latest.args b/tests/qemuxml2argvdata/disk-network-nfs.x86_64-latest.args index b4fbfcee8f..1db2f5d30a 100644 --- a/tests/qemuxml2argvdata/disk-network-nfs.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-network-nfs.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"nfs","server":{"host":"example.com","type":"inet"},"path":"/foo/bar/baz","user":6234,"group":12354,"node-name":"libvirt-3-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"nfs","server":{"host":"example.com","type":"inet"},"path":"/foo/bar/baz","user":6234,"group":12354,"node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-3-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x4","drive":"libvirt-3-format","id":"virtio-disk0","bootindex":1,"write-cache":"on","serial":"eb90327c-8302-4725-9e1b-4e85ed4dc251"}' \ -blockdev '{"driver":"nfs","server":{"host":"example.org","type":"inet"},"path":"/backing/store/nfs","user":1234,"group":5678,"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ diff --git a/tests/qemuxml2argvdata/disk-network-tlsx509-nbd-hostname.x86_64-latest.args b/tests/qemuxml2argvdata/disk-network-tlsx509-nbd-hostname.x86_64-latest.args index 5f5c412e22..5030e76a75 100644 --- a/tests/qemuxml2argvdata/disk-network-tlsx509-nbd-hostname.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-network-tlsx509-nbd-hostname.x86_64-latest.args @@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ -object '{"qom-type":"secret","id":"objlibvirt-1-storage_tls0-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \ -object '{"qom-type":"tls-creds-x509","id":"objlibvirt-1-storage_tls0","dir":"/etc/pki/libvirt-nbd","endpoint":"client","verify-peer":true,"passwordid":"objlibvirt-1-storage_tls0-secret0"}' \ --blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.com","port":"1234"},"tls-creds":"objlibvirt-1-storage_tls0","tls-hostname":"test-hostname","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.com","port":"1234"},"tls-creds":"objlibvirt-1-storage_tls0","tls-hostname":"test-hostname","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x7","drive":"libvirt-1-format","id":"virtio-disk3","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/disk-network-tlsx509-nbd.x86_64-5.2.0.args b/tests/qemuxml2argvdata/disk-network-tlsx509-nbd.x86_64-5.2.0.args index 2863f78a4c..676c021dab 100644 --- a/tests/qemuxml2argvdata/disk-network-tlsx509-nbd.x86_64-5.2.0.args +++ b/tests/qemuxml2argvdata/disk-network-tlsx509-nbd.x86_64-5.2.0.args @@ -30,7 +30,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -object secret,id=objlibvirt-1-storage_tls0-secret0,data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \ -object tls-creds-x509,id=objlibvirt-1-storage_tls0,dir=/etc/pki/libvirt-nbd,endpoint=client,verify-peer=on,passwordid=objlibvirt-1-storage_tls0-secret0 \ --blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.com","port":"1234"},"tls-creds":"objlibvirt-1-storage_tls0","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.com","port":"1234"},"tls-creds":"objlibvirt-1-storage_tls0","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}' \ -device virtio-blk-pci,bus=pci.0,addr=0x7,drive=libvirt-1-format,id=virtio-disk3,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/disk-network-tlsx509-nbd.x86_64-latest.args b/tests/qemuxml2argvdata/disk-network-tlsx509-nbd.x86_64-latest.args index f499dac90f..905d8c2451 100644 --- a/tests/qemuxml2argvdata/disk-network-tlsx509-nbd.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-network-tlsx509-nbd.x86_64-latest.args @@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ -object '{"qom-type":"secret","id":"objlibvirt-1-storage_tls0-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \ -object '{"qom-type":"tls-creds-x509","id":"objlibvirt-1-storage_tls0","dir":"/etc/pki/libvirt-nbd","endpoint":"client","verify-peer":true,"passwordid":"objlibvirt-1-storage_tls0-secret0"}' \ --blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.com","port":"1234"},"tls-creds":"objlibvirt-1-storage_tls0","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.com","port":"1234"},"tls-creds":"objlibvirt-1-storage_tls0","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x7","drive":"libvirt-1-format","id":"virtio-disk3","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/disk-network-tlsx509-vxhs.x86_64-5.0.0.args b/tests/qemuxml2argvdata/disk-network-tlsx509-vxhs.x86_64-5.0.0.args index c96d105362..b401400999 100644 --- a/tests/qemuxml2argvdata/disk-network-tlsx509-vxhs.x86_64-5.0.0.args +++ b/tests/qemuxml2argvdata/disk-network-tlsx509-vxhs.x86_64-5.0.0.args @@ -29,15 +29,15 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -object secret,id=objlibvirt-3-storage_tls0-secret0,data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \ -object tls-creds-x509,id=objlibvirt-3-storage_tls0,dir=/etc/pki/libvirt-vxhs,endpoint=client,verify-peer=on,passwordid=objlibvirt-3-storage_tls0-secret0 \ --blockdev '{"driver":"vxhs","tls-creds":"objlibvirt-3-storage_tls0","vdisk-id":"eb90327c-8302-4725-9e1b-4e85ed4dc251","server":{"host":"192.168.0.1","port":"9999"},"node-name":"libvirt-3-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"vxhs","tls-creds":"objlibvirt-3-storage_tls0","vdisk-id":"eb90327c-8302-4725-9e1b-4e85ed4dc251","server":{"host":"192.168.0.1","port":"9999"},"node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-3-storage"}' \ -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=libvirt-3-format,id=virtio-disk0,bootindex=1,write-cache=on,serial=eb90327c-8302-4725-9e1b-4e85ed4dc251 \ -object secret,id=objlibvirt-2-storage_tls0-secret0,data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \ -object tls-creds-x509,id=objlibvirt-2-storage_tls0,dir=/etc/pki/libvirt-vxhs,endpoint=client,verify-peer=on,passwordid=objlibvirt-2-storage_tls0-secret0 \ --blockdev '{"driver":"vxhs","tls-creds":"objlibvirt-2-storage_tls0","vdisk-id":"eb90327c-8302-4725-9e1b-4e85ed4dc252","server":{"host":"192.168.0.2","port":"9999"},"node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"vxhs","tls-creds":"objlibvirt-2-storage_tls0","vdisk-id":"eb90327c-8302-4725-9e1b-4e85ed4dc252","server":{"host":"192.168.0.2","port":"9999"},"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-2-storage"}' \ -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=libvirt-2-format,id=virtio-disk1,write-cache=on,serial=eb90327c-8302-4725-9e1b-4e85ed4dc252 \ --blockdev '{"driver":"vxhs","vdisk-id":"eb90327c-8302-4725-9e1b-4e85ed4dc253","server":{"host":"192.168.0.3","port":"9999"},"node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"vxhs","vdisk-id":"eb90327c-8302-4725-9e1b-4e85ed4dc253","server":{"host":"192.168.0.3","port":"9999"},"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}' \ -device virtio-blk-pci,bus=pci.0,addr=0x6,drive=libvirt-1-format,id=virtio-disk2,write-cache=on,serial=eb90327c-8302-4725-9e1b-4e85ed4dc252 \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/disk-nvme.x86_64-latest.args b/tests/qemuxml2argvdata/disk-nvme.x86_64-latest.args index 8dccaebf11..b4b8a62447 100644 --- a/tests/qemuxml2argvdata/disk-nvme.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-nvme.x86_64-latest.args @@ -38,7 +38,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"raw","file":"libvirt-2-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x6","drive":"libvirt-2-format","id":"virtio-disk2"}' \ -object '{"qom-type":"secret","id":"libvirt-1-format-encryption-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \ --blockdev '{"driver":"nvme","device":"0001:02:00.0","namespace":2,"node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"nvme","device":"0001:02:00.0","namespace":2,"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","encrypt":{"format":"luks","key-secret":"libvirt-1-format-encryption-secret0"},"file":"libvirt-1-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x7","drive":"libvirt-1-format","id":"virtio-disk3","write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/disk-shared.x86_64-latest.args b/tests/qemuxml2argvdata/disk-shared.x86_64-latest.args index 9059d3c369..9ef920d1e9 100644 --- a/tests/qemuxml2argvdata/disk-shared.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-shared.x86_64-latest.args @@ -28,16 +28,16 @@ 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/HostVG/QEMUGuest1","node-name":"libvirt-4-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-4-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-4-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"share-rw":true,"drive":"libvirt-4-format","id":"ide0-0-0","bootindex":1,"write-cache":"on","serial":"XYZXYZXYZYXXYZYZYXYZY"}' \ -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-3-format","read-only":true,"driver":"raw","file":"libvirt-3-storage"}' \ -device '{"driver":"ide-cd","bus":"ide.1","unit":0,"drive":"libvirt-3-format","id":"ide0-1-0"}' \ --blockdev '{"driver":"host_device","filename":"/dev/scsi","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/scsi","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-2-storage"}' \ -device '{"driver":"scsi-hd","bus":"scsi0.0","channel":0,"scsi-id":0,"lun":0,"device_id":"drive-scsi0-0-0-0","share-rw":true,"drive":"libvirt-2-format","id":"scsi0-0-0-0","write-cache":"on"}' \ --blockdev '{"driver":"host_device","filename":"/dev/virtio","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/virtio","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","share-rw":true,"drive":"libvirt-1-format","id":"virtio-disk0","write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args index 25ee975619..deaa094379 100644 --- a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args @@ -45,7 +45,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"raw","offset":1234,"size":321,"file":"libvirt-2-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x6","drive":"libvirt-2-format","id":"virtio-disk3"}' \ -object '{"qom-type":"secret","id":"libvirt-1-format-encryption-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \ --blockdev '{"driver":"nvme","device":"0001:02:00.0","namespace":2,"node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"nvme","device":"0001:02:00.0","namespace":2,"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"driver":"raw","node-name":"libvirt-1-slice-sto","offset":1234,"size":321,"file":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","encrypt":{"format":"luks","key-secret":"libvirt-1-format-encryption-secret0"},"file":"libvirt-1-slice-sto"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x7","drive":"libvirt-1-format","id":"virtio-disk4","write-cache":"on"}' \ diff --git a/tests/qemuxml2argvdata/disk-snapshot.x86_64-latest.args b/tests/qemuxml2argvdata/disk-snapshot.x86_64-latest.args index f8830e3ae4..67584ad565 100644 --- a/tests/qemuxml2argvdata/disk-snapshot.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-snapshot.x86_64-latest.args @@ -27,10 +27,10 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-3-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-3-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-3-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest3","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest3","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-2-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.2","unit":0,"drive":"libvirt-2-format","id":"ide0-2-0","write-cache":"on"}' \ -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ diff --git a/tests/qemuxml2argvdata/disk-transient.x86_64-latest.args b/tests/qemuxml2argvdata/disk-transient.x86_64-latest.args index d586cdafd9..101435a991 100644 --- a/tests/qemuxml2argvdata/disk-transient.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-transient.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/tmp/QEMUGuest1.img","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/tmp/QEMUGuest1.img","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/disk-vhostvdpa.x86_64-latest.args b/tests/qemuxml2argvdata/disk-vhostvdpa.x86_64-latest.args index b987455ee4..872858ddf4 100644 --- a/tests/qemuxml2argvdata/disk-vhostvdpa.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-vhostvdpa.x86_64-latest.args @@ -28,7 +28,7 @@ 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"}' \ -add-fd set=0,fd=801,opaque=libvirt-1-storage-vdpa \ --blockdev '{"driver":"virtio-blk-vhost-vdpa","path":"/dev/fdset/0","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"virtio-blk-vhost-vdpa","path":"/dev/fdset/0","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-1-format","id":"virtio-disk0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/name-escape.x86_64-latest.args b/tests/qemuxml2argvdata/name-escape.x86_64-latest.args index 7ccea7d740..096a774caa 100644 --- a/tests/qemuxml2argvdata/name-escape.x86_64-latest.args +++ b/tests/qemuxml2argvdata/name-escape.x86_64-latest.args @@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-foo=1,bar=2/.config \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ -device '{"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.0","addr":"0x3"}' \ -device '{"driver":"usb-ccid","id":"ccid0","bus":"usb.0","port":"1"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -device '{"driver":"ccid-card-emulated","backend":"certificates","cert1":"cert1,foo","cert2":"cert2","cert3":"cert3","db":"/etc/pki/nssdb,foo","id":"smartcard0","bus":"ccid0.0"}' \ diff --git a/tests/qemuxml2argvdata/user-aliases.x86_64-latest.args b/tests/qemuxml2argvdata/user-aliases.x86_64-latest.args index defc2c95ce..df0005f8dc 100644 --- a/tests/qemuxml2argvdata/user-aliases.x86_64-latest.args +++ b/tests/qemuxml2argvdata/user-aliases.x86_64-latest.args @@ -38,7 +38,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-gentoo/.config \ -device '{"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.0","addr":"0x8"}' \ -device '{"driver":"usb-ccid","id":"ua-myCCID","bus":"ua-SomeWeirdController.0","port":"1"}' \ -device '{"driver":"usb-ccid","id":"ua-myCCID2","bus":"ua-SomeWeirdController.0","port":"2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/fd.img","node-name":"libvirt-4-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/fd.img","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-4-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-4-storage"}' \ -device '{"driver":"floppy","unit":0,"drive":"libvirt-4-format","id":"ua-myDisk1","write-cache":"on"}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/gentoo.qcow2","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \ @@ -48,7 +48,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-gentoo/.config \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/OtherDemo.img","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"qcow2","encrypt":{"format":"luks","key-secret":"libvirt-2-format-encryption-secret0"},"file":"libvirt-2-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x7","drive":"libvirt-2-format","id":"ua-myEncryptedDisk1"}' \ --blockdev '{"driver":"file","filename":"/home/zippy/tmp/install-amd64-minimal-20140619.iso","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/home/zippy/tmp/install-amd64-minimal-20140619.iso","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":true,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-cd","bus":"ide.1","unit":0,"share-rw":true,"drive":"libvirt-1-format","id":"ua-WhatAnAwesomeCDROM","bootindex":2,"write-cache":"on"}' \ -netdev '{"type":"tap","fd":"3","vhost":true,"vhostfd":"44","id":"hostua-CheckoutThisNIC"}' \ diff --git a/tests/qemuxml2argvdata/video-bochs-display-device.x86_64-latest.args b/tests/qemuxml2argvdata/video-bochs-display-device.x86_64-latest.args index f1d22cd422..893d1448db 100644 --- a/tests/qemuxml2argvdata/video-bochs-display-device.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-bochs-display-device.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-device-pciaddr-default.x86_64-latest.args b/tests/qemuxml2argvdata/video-device-pciaddr-default.x86_64-latest.args index b6fd9f4efa..09583d06f2 100644 --- a/tests/qemuxml2argvdata/video-device-pciaddr-default.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-device-pciaddr-default.x86_64-latest.args @@ -26,7 +26,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-qxl-device-vgamem.x86_64-latest.args b/tests/qemuxml2argvdata/video-qxl-device-vgamem.x86_64-latest.args index d9c66dc396..84b9f4f73e 100644 --- a/tests/qemuxml2argvdata/video-qxl-device-vgamem.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-qxl-device-vgamem.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-qxl-device.x86_64-latest.args b/tests/qemuxml2argvdata/video-qxl-device.x86_64-latest.args index d9c66dc396..84b9f4f73e 100644 --- a/tests/qemuxml2argvdata/video-qxl-device.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-qxl-device.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-qxl-sec-device-vgamem.x86_64-latest.args b/tests/qemuxml2argvdata/video-qxl-sec-device-vgamem.x86_64-latest.args index 045c124005..8040756044 100644 --- a/tests/qemuxml2argvdata/video-qxl-sec-device-vgamem.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-qxl-sec-device-vgamem.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-qxl-sec-device.x86_64-latest.args b/tests/qemuxml2argvdata/video-qxl-sec-device.x86_64-latest.args index 045c124005..8040756044 100644 --- a/tests/qemuxml2argvdata/video-qxl-sec-device.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-qxl-sec-device.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-ramfb-display-device.x86_64-latest.args b/tests/qemuxml2argvdata/video-ramfb-display-device.x86_64-latest.args index d2f5cea74a..0a52f9dc08 100644 --- a/tests/qemuxml2argvdata/video-ramfb-display-device.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-ramfb-display-device.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-vga-device-vgamem.x86_64-latest.args b/tests/qemuxml2argvdata/video-vga-device-vgamem.x86_64-latest.args index 0f2b1ec023..f5bc6a1dcf 100644 --- a/tests/qemuxml2argvdata/video-vga-device-vgamem.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-vga-device-vgamem.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-vga-device.x86_64-latest.args b/tests/qemuxml2argvdata/video-vga-device.x86_64-latest.args index 0f2b1ec023..f5bc6a1dcf 100644 --- a/tests/qemuxml2argvdata/video-vga-device.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-vga-device.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-virtio-blob-off.x86_64-latest.args b/tests/qemuxml2argvdata/video-virtio-blob-off.x86_64-latest.args index f46fb2986d..837d5055c1 100644 --- a/tests/qemuxml2argvdata/video-virtio-blob-off.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-virtio-blob-off.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-virtio-blob-on.x86_64-latest.args b/tests/qemuxml2argvdata/video-virtio-blob-on.x86_64-latest.args index 577422426b..172bd372e1 100644 --- a/tests/qemuxml2argvdata/video-virtio-blob-on.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-virtio-blob-on.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-device.x86_64-latest.args b/tests/qemuxml2argvdata/video-virtio-gpu-device.x86_64-latest.args index c7e867cfcd..fec2b04ca9 100644 --- a/tests/qemuxml2argvdata/video-virtio-gpu-device.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-virtio-gpu-device.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.x86_64-latest.args b/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.x86_64-latest.args index 84215bb370..9ab281a94d 100644 --- a/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.x86_64-latest.args @@ -26,7 +26,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -display sdl,gl=on \ diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-spice-gl.x86_64-latest.args b/tests/qemuxml2argvdata/video-virtio-gpu-spice-gl.x86_64-latest.args index a7c40489ec..7a2a85f863 100644 --- a/tests/qemuxml2argvdata/video-virtio-gpu-spice-gl.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-virtio-gpu-spice-gl.x86_64-latest.args @@ -26,7 +26,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"spice"}' \ diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-virgl.x86_64-latest.args b/tests/qemuxml2argvdata/video-virtio-gpu-virgl.x86_64-latest.args index 3b6bcceb8d..5cd1b7998b 100644 --- a/tests/qemuxml2argvdata/video-virtio-gpu-virgl.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-virtio-gpu-virgl.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ diff --git a/tests/qemuxml2argvdata/video-virtio-vga.x86_64-latest.args b/tests/qemuxml2argvdata/video-virtio-vga.x86_64-latest.args index c7e867cfcd..fec2b04ca9 100644 --- a/tests/qemuxml2argvdata/video-virtio-vga.x86_64-latest.args +++ b/tests/qemuxml2argvdata/video-virtio-vga.x86_64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1,"write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -- 2.41.0

The new helper replaces qemuBlockStorageSourceGetBlockdevFormatCommonProps and the two inline instances generating the common properties for a blockdev layer. The new helper is to be used for both the format layer and the storage backing layer, thus a new parameter 'effective' switches between the modes. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 128 +++++++++++++++++++++++++++++------------- 1 file changed, 88 insertions(+), 40 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 689eb535cb..aeb05a7f00 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -931,6 +931,90 @@ qemuBlockStorageSourceGetBlockdevGetCacheProps(virStorageSource *src, } +/** + * qemuBlockStorageSourceAddBlockdevCommonProps: + * @props: JSON object to append the props to + * @src: storage source + * @nodename: nodename to use for @src + * @effective: Whether props for the effective(topmost) layer are to be formatted + * + * Add the common props (node name, read-only state, cache configuration, discard) + * to a JSON object for a -blockdev definition. If @effective is true, + * the props are configured for the topmost layer used to access the data, + * otherwise the props are configured for the storage protocol backing a format + * layer. + */ +static int +qemuBlockStorageSourceAddBlockdevCommonProps(virJSONValue **props, + virStorageSource *src, + const char *nodename, + bool effective) +{ + virStorageType actualType = virStorageSourceGetActualType(src); + g_autoptr(virJSONValue) cache = NULL; + const char *detectZeroes = NULL; + const char *discard = NULL; + virTristateBool autoReadOnly = VIR_TRISTATE_BOOL_ABSENT; + virTristateBool readOnly = VIR_TRISTATE_BOOL_ABSENT; + + if (qemuBlockNodeNameValidate(nodename) < 0) + return -1; + + if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0) + return -1; + + if (effective) { + virDomainDiskDetectZeroes dz = virDomainDiskGetDetectZeroesMode(src->discard, + src->detect_zeroes); + + if (src->discard != VIR_DOMAIN_DISK_DISCARD_DEFAULT) + discard = virDomainDiskDiscardTypeToString(src->discard); + + if (dz != VIR_DOMAIN_DISK_DETECT_ZEROES_DEFAULT) + detectZeroes = virDomainDiskDetectZeroesTypeToString(dz); + + autoReadOnly = VIR_TRISTATE_BOOL_ABSENT; + readOnly = virTristateBoolFromBool(src->readonly); + } else { + /* when passing a FD to qemu via the /dev/fdset mechanism qemu + * fetches the appropriate FD from the fdset by checking that it has + * the correct accessmode. Now with 'auto-read-only' in effect qemu + * wants to use a read-only FD first. If the user didn't pass multiple + * FDs the feature will not work regardless, so we'll not enable it. */ + if ((actualType == VIR_STORAGE_TYPE_FILE || actualType == VIR_STORAGE_TYPE_BLOCK) && + src->fdtuple && src->fdtuple->nfds == 1) { + autoReadOnly = VIR_TRISTATE_BOOL_ABSENT; + + /* now we setup the normal readonly flag. If user requested write access honour it */ + if (src->fdtuple->writable) + readOnly = VIR_TRISTATE_BOOL_NO; + else + readOnly = virTristateBoolFromBool(src->readonly); + } else { + autoReadOnly = VIR_TRISTATE_BOOL_YES; + } + + discard = "unmap"; + } + + /* currently unhandled global properties: + * '*force-share': 'bool' + */ + + if (virJSONValueObjectAdd(props, + "s:node-name", nodename, + "T:read-only", readOnly, + "T:auto-read-only", autoReadOnly, + "S:discard", discard, + "S:detect-zeroes", detectZeroes, + "A:cache", &cache, + NULL) < 0) + return -1; + + return 0; +} + + /** * qemuBlockStorageSourceGetBackendProps: * @src: disk source @@ -1265,52 +1349,16 @@ qemuBlockStorageSourceGetFormatQcow2Props(virStorageSource *src, } -static virJSONValue * -qemuBlockStorageSourceGetBlockdevFormatCommonProps(virStorageSource *src) -{ - const char *detectZeroes = NULL; - const char *discard = NULL; - virDomainDiskDetectZeroes detectZeroesMode = virDomainDiskGetDetectZeroesMode(src->discard, - src->detect_zeroes); - g_autoptr(virJSONValue) props = NULL; - g_autoptr(virJSONValue) cache = NULL; - - if (qemuBlockNodeNameValidate(qemuBlockStorageSourceGetFormatNodename(src)) < 0) - return NULL; - - if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0) - return NULL; - - if (src->discard) - discard = virDomainDiskDiscardTypeToString(src->discard); - - if (detectZeroesMode) - detectZeroes = virDomainDiskDetectZeroesTypeToString(detectZeroesMode); - - /* currently unhandled global properties: - * '*force-share': 'bool' - */ - - if (virJSONValueObjectAdd(&props, - "s:node-name", qemuBlockStorageSourceGetFormatNodename(src), - "b:read-only", src->readonly, - "S:discard", discard, - "S:detect-zeroes", detectZeroes, - "A:cache", &cache, - NULL) < 0) - return NULL; - - return g_steal_pointer(&props); -} - - static virJSONValue * qemuBlockStorageSourceGetBlockdevFormatProps(virStorageSource *src) { const char *driver = NULL; g_autoptr(virJSONValue) props = NULL; - if (!(props = qemuBlockStorageSourceGetBlockdevFormatCommonProps(src))) + if (qemuBlockStorageSourceAddBlockdevCommonProps(&props, + src, + qemuBlockStorageSourceGetFormatNodename(src), + true) < 0) return NULL; switch ((virStorageFileFormat) src->format) { -- 2.41.0

Use the new helper in qemuBlockStorageSourceGetBlockdevStorageSliceProps to format the common bits. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 17 ++++++----------- .../disk-slices.x86_64-latest.args | 6 +++--- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index aeb05a7f00..dc6f34530b 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1484,26 +1484,21 @@ static virJSONValue * qemuBlockStorageSourceGetBlockdevStorageSliceProps(virStorageSource *src) { g_autoptr(virJSONValue) props = NULL; - g_autoptr(virJSONValue) cache = NULL; - - if (qemuBlockNodeNameValidate(src->sliceStorage->nodename) < 0) - return NULL; - - if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0) - return NULL; if (virJSONValueObjectAdd(&props, "s:driver", "raw", - "s:node-name", src->sliceStorage->nodename, "U:offset", src->sliceStorage->offset, "U:size", src->sliceStorage->size, "s:file", qemuBlockStorageSourceGetStorageNodename(src), - "b:auto-read-only", true, - "s:discard", "unmap", - "A:cache", &cache, NULL) < 0) return NULL; + if (qemuBlockStorageSourceAddBlockdevCommonProps(&props, + src, + src->sliceStorage->nodename, + false) < 0) + return NULL; + return g_steal_pointer(&props); } diff --git a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args index deaa094379..363f0c0361 100644 --- a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args @@ -31,14 +31,14 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -blockdev '{"node-name":"libvirt-6-format","read-only":false,"driver":"raw","offset":0,"size":321,"file":"libvirt-6-storage"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-6-format","id":"virtio-disk0","bootindex":1}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/raw.img","node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"driver":"raw","node-name":"libvirt-5-slice-sto","offset":9876,"size":123456789,"file":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"raw","offset":9876,"size":123456789,"file":"libvirt-5-storage","node-name":"libvirt-5-slice-sto","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-5-format","read-only":true,"driver":"qcow2","file":"libvirt-5-slice-sto","backing":null}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/overlay.qcow2","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-4-format","read-only":false,"driver":"qcow2","file":"libvirt-4-storage","backing":"libvirt-5-format"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-4-format","id":"virtio-disk1"}' \ -object '{"qom-type":"secret","id":"libvirt-3-format-encryption-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/luks.img","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"driver":"raw","node-name":"libvirt-3-slice-sto","offset":1234,"size":321,"file":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"raw","offset":1234,"size":321,"file":"libvirt-3-storage","node-name":"libvirt-3-slice-sto","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"luks","key-secret":"libvirt-3-format-encryption-secret0","file":"libvirt-3-slice-sto"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x4","drive":"libvirt-3-format","id":"virtio-disk2"}' \ -blockdev '{"driver":"nvme","device":"0000:02:00.0","namespace":1,"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ @@ -46,7 +46,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x6","drive":"libvirt-2-format","id":"virtio-disk3"}' \ -object '{"qom-type":"secret","id":"libvirt-1-format-encryption-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \ -blockdev '{"driver":"nvme","device":"0001:02:00.0","namespace":2,"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ --blockdev '{"driver":"raw","node-name":"libvirt-1-slice-sto","offset":1234,"size":321,"file":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ +-blockdev '{"driver":"raw","offset":1234,"size":321,"file":"libvirt-1-storage","node-name":"libvirt-1-slice-sto","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","encrypt":{"format":"luks","key-secret":"libvirt-1-format-encryption-secret0"},"file":"libvirt-1-slice-sto"}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x7","drive":"libvirt-1-format","id":"virtio-disk4","write-cache":"on"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -- 2.41.0

Introduce a mode where the protocol layer -blockdev will be formatted so that it can be used as the effective node (used to access data from the device). For this new mode we'll use qemuBlockStorageSourceAddBlockdevCommonProps. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 40 ++++++++++++++++++++++++---------------- src/qemu/qemu_block.h | 1 + 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index dc6f34530b..7902ef31b3 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1030,6 +1030,8 @@ qemuBlockStorageSourceAddBlockdevCommonProps(virJSONValue **props, * QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP: * don't enable 'discard:unmap' option for passing through discards * (note that this is disabled also for _LEGACY and _TARGET_ONLY options) + * QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE: + * the 'protocol' node is used as the effective/top node of a virStorageSource * * Creates a JSON object describing the underlying storage or protocol of a * storage source. Returns NULL on error and reports an appropriate error message. @@ -1182,27 +1184,33 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src, return NULL; if (!onlytarget && !legacy) { - g_autoptr(virJSONValue) cache = NULL; - const char *discardstr = "unmap"; const char *nodename = qemuBlockStorageSourceGetStorageNodename(src); - if (flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP) - discardstr = NULL; + if (flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE) { + if (qemuBlockStorageSourceAddBlockdevCommonProps(&fileprops, src, nodename, true) < 0) + return NULL; + } else { + g_autoptr(virJSONValue) cache = NULL; + const char *discardstr = "unmap"; - if (qemuBlockNodeNameValidate(nodename) < 0) - return NULL; + if (flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP) + discardstr = NULL; - if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0) - return NULL; + if (qemuBlockNodeNameValidate(nodename) < 0) + return NULL; - if (virJSONValueObjectAdd(&fileprops, - "s:node-name", nodename, - "T:read-only", ro, - "T:auto-read-only", aro, - "S:discard", discardstr, - "A:cache", &cache, - NULL) < 0) - return NULL; + if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0) + return NULL; + + if (virJSONValueObjectAdd(&fileprops, + "s:node-name", nodename, + "T:read-only", ro, + "T:auto-read-only", aro, + "S:discard", discardstr, + "A:cache", &cache, + NULL) < 0) + return NULL; + } } return g_steal_pointer(&fileprops); diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 7bb83d8d44..9757108501 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -68,6 +68,7 @@ typedef enum { QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY = 1 << 1, QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY = 1 << 2, QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP = 1 << 3, + QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE = 1 << 4, } qemuBlockStorageSourceBackendPropsFlags; virJSONValue * -- 2.41.0

The resulting properties are identical, as the hostdev backend code doesn't set any of the extra properties. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_command.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 98e7fa3d80..2674dd6959 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5066,8 +5066,7 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDef *hostdev, ret->storageNodeName = qemuBlockStorageSourceGetStorageNodename(src); *backendAlias = qemuBlockStorageSourceGetStorageNodename(src); - if (!(ret->storageProps = qemuBlockStorageSourceGetBackendProps(src, - QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP))) + if (!(ret->storageProps = qemuBlockStorageSourceGetBackendProps(src, QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE))) return NULL; if (qemuBuildStorageSourceAttachPrepareCommon(src, ret) < 0) -- 2.41.0

Use the qemuBlockStorageSourceAddBlockdevCommonProps helper when formatting protocol layer both when it's used as backing for a format node and when it's used as the effective node. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 7902ef31b3..5c8d107257 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1184,33 +1184,10 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src, return NULL; if (!onlytarget && !legacy) { - const char *nodename = qemuBlockStorageSourceGetStorageNodename(src); - - if (flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE) { - if (qemuBlockStorageSourceAddBlockdevCommonProps(&fileprops, src, nodename, true) < 0) - return NULL; - } else { - g_autoptr(virJSONValue) cache = NULL; - const char *discardstr = "unmap"; - - if (flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP) - discardstr = NULL; - - if (qemuBlockNodeNameValidate(nodename) < 0) + if (qemuBlockStorageSourceAddBlockdevCommonProps(&fileprops, src, + qemuBlockStorageSourceGetStorageNodename(src), + !!(flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE)) < 0) return NULL; - - if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0) - return NULL; - - if (virJSONValueObjectAdd(&fileprops, - "s:node-name", nodename, - "T:read-only", ro, - "T:auto-read-only", aro, - "S:discard", discardstr, - "A:cache", &cache, - NULL) < 0) - return NULL; - } } return g_steal_pointer(&fileprops); -- 2.41.0

The code was refactored to format the 'read-only' and 'auto-read-only' flags via the common helper, so the logic determining their values can be removed. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 5c8d107257..a625e72a5d 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -806,9 +806,7 @@ qemuBlockStorageSourceGetSshProps(virStorageSource *src) static virJSONValue * qemuBlockStorageSourceGetFileProps(virStorageSource *src, - bool onlytarget, - virTristateBool *autoReadOnly, - virTristateBool *readOnly) + bool onlytarget) { const char *path = src->path; const char *iomode = NULL; @@ -824,25 +822,8 @@ qemuBlockStorageSourceGetFileProps(virStorageSource *src, if (src->iomode != VIR_DOMAIN_DISK_IO_DEFAULT) iomode = virDomainDiskIoTypeToString(src->iomode); - if (srcpriv && srcpriv->fdpass) { + if (srcpriv && srcpriv->fdpass) path = qemuFDPassGetPath(srcpriv->fdpass); - - /* when passing a FD to qemu via the /dev/fdset mechanism qemu - * fetches the appropriate FD from the fdset by checking that it has - * the correct accessmode. Now with 'auto-read-only' in effect qemu - * wants to use a read-only FD first. If the user didn't pass multiple - * FDs the feature will not work regardless, so we'll disable it. */ - if (src->fdtuple->nfds == 1) { - *autoReadOnly = VIR_TRISTATE_BOOL_ABSENT; - - /* now we setup the normal readonly flag. If user requested write - * access honour it */ - if (src->fdtuple->writable) - *readOnly = VIR_TRISTATE_BOOL_NO; - else - *readOnly = virTristateBoolFromBool(src->readonly); - } - } } ignore_value(virJSONValueObjectAdd(&ret, @@ -1043,20 +1024,9 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src, virStorageType actualType = virStorageSourceGetActualType(src); g_autoptr(virJSONValue) fileprops = NULL; const char *driver = NULL; - virTristateBool aro = VIR_TRISTATE_BOOL_ABSENT; - virTristateBool ro = VIR_TRISTATE_BOOL_ABSENT; bool onlytarget = flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY; bool legacy = flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_LEGACY; - if (flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY) { - aro = VIR_TRISTATE_BOOL_YES; - } else { - if (src->readonly) - ro = VIR_TRISTATE_BOOL_YES; - else - ro = VIR_TRISTATE_BOOL_NO; - } - switch (actualType) { case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_FILE: @@ -1069,7 +1039,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src, driver = "file"; } - if (!(fileprops = qemuBlockStorageSourceGetFileProps(src, onlytarget, &aro, &ro))) + if (!(fileprops = qemuBlockStorageSourceGetFileProps(src, onlytarget))) return NULL; break; -- 2.41.0

QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP is no longer referenced inside the code. QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY is passed from various code paths to the qemuBlockStorageSourceGetBackendProps helper, but it's no longer used. Both thus can be removed. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_block.c | 7 +------ src/qemu/qemu_block.h | 4 +--- tests/qemublocktest.c | 7 ++----- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index a625e72a5d..382015f293 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1006,11 +1006,6 @@ qemuBlockStorageSourceAddBlockdevCommonProps(virJSONValue **props, * use legacy formatting of attributes (for -drive / old qemus) * QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY: * omit any data which does not identify the image itself - * QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY: - * use the auto-read-only feature of qemu - * QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP: - * don't enable 'discard:unmap' option for passing through discards - * (note that this is disabled also for _LEGACY and _TARGET_ONLY options) * QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE: * the 'protocol' node is used as the effective/top node of a virStorageSource * @@ -1510,7 +1505,7 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSource *src, virStorageSource *backingStore) { g_autoptr(qemuBlockStorageSourceAttachData) data = NULL; - unsigned int backendpropsflags = QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY; + unsigned int backendpropsflags = 0; data = g_new0(qemuBlockStorageSourceAttachData, 1); diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 9757108501..5c784a4386 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -66,9 +66,7 @@ qemuBlockStorageSourceSupportsConcurrentAccess(virStorageSource *src); typedef enum { QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_LEGACY = 1 << 0, QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY = 1 << 1, - QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY = 1 << 2, - QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP = 1 << 3, - QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE = 1 << 4, + QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE = 1 << 2, } qemuBlockStorageSourceBackendPropsFlags; virJSONValue * diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index b8db1a2570..c581bd1748 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -285,9 +285,6 @@ testQemuDiskXMLToProps(const void *opaque) for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) { g_autofree char *backingstore = NULL; - unsigned int backendpropsflagsnormal = QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY; - unsigned int backendpropsflagstarget = QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY | - QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY; if (testQemuDiskXMLToJSONFakeSecrets(n) < 0) return -1; @@ -298,8 +295,8 @@ testQemuDiskXMLToProps(const void *opaque) qemuDomainPrepareDiskSourceData(disk, n); if (!(formatProps = qemuBlockStorageSourceGetFormatProps(n, n->backingStore)) || - !(storageSrcOnlyProps = qemuBlockStorageSourceGetBackendProps(n, backendpropsflagstarget)) || - !(storageProps = qemuBlockStorageSourceGetBackendProps(n, backendpropsflagsnormal)) || + !(storageSrcOnlyProps = qemuBlockStorageSourceGetBackendProps(n, QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY)) || + !(storageProps = qemuBlockStorageSourceGetBackendProps(n, 0)) || !(backingstore = qemuBlockGetBackingStoreString(n, true))) { if (!data->fail) { VIR_TEST_VERBOSE("failed to generate qemu blockdev props"); -- 2.41.0

On a Wednesday in 2023, Peter Krempa wrote:
Second part cleans up tests and various bits and refactors the protocol blockdev JSON configuration generator to be reusable.
This still doesn't change the configuration of the blockdevs, just reorders some arguments.
Peter Krempa (22): qemuxml2(argv|xml)test: Add network backed disk type='sd' qemu: migration: No longer avoid 'auto-read-only' option for migration qemuBuildDriveSourceStr: Absorb only use of qemuDiskSourceGetProps qemuBlockStorageSourceGetBackendProps: Remove unnecessary indent for non-nbdkit code path conf: Move definition of some disk type enums to a common header virStorageSource: Use proper type for shadow copies of iomode/cachemode/discard/detect_zeroes qemuDomainDiskCachemodeFlags: Simplify usage qemuBlockStorageSourceGetBlockdevGetCacheProps: Return the cache object rather than appending it qemublocktest: Use "target only" mode in 'testJSONtoJSON' and 'testBackingXMLjsonXML' qemublocktest: Drop 'sheepdog' and 'vxhs' test cases qemublocktest: Fix logical bug in TEST_JSON_FORMAT macro qemublocktest: testBackingXMLjsonXML: Drop 'legacy' mode qemuBlockStorageSourceGetBackendProps: Unify cases for '!onlytarget' and '!legacy' virDomainDiskGetDetectZeroesMode: Return proper type qemuBlockStorageSourceGetBackendProps: Unify ordering of fields qemu: block: Add helper to add common properties for -blockdev configuration qemu: block: Use qemuBlockStorageSourceAddBlockdevCommonProps for storage slice qemuBlockStorageSourceGetBackendProps: Introduce QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_EFFECTIVE_NODE qemuBuildHostdevSCSIAttachPrepare: Use "effective node" mode for getting blockdev props qemuBlockStorageSourceGetBackendProps: Use qemuBlockStorageSourceAddBlockdevCommonProps qemuBlockStorageSourceGetBackendProps: Remove unused logic for (auto-)read-only flags qemu: block: Remove unused flags QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_ flags
src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 39 +- src/conf/storage_source_conf.h | 8 +- src/conf/virconftypes.h | 39 +- src/qemu/qemu_block.c | 349 +++++++++--------- src/qemu/qemu_block.h | 6 +- src/qemu/qemu_command.c | 63 ++-- src/qemu/qemu_domain.c | 33 +- src/qemu/qemu_domain.h | 4 +- src/qemu/qemu_migration.c | 5 +- tests/qemublocktest.c | 41 +- .../jsontojson/curl-libguestfs-out.json | 5 +- .../ssh-passthrough-libguestfs-out.json | 4 +- .../xml2json/dir-fat-cache.json | 6 +- .../file-backing_basic-cache-directsync.json | 24 +- .../file-backing_basic-cache-none.json | 24 +- .../file-backing_basic-cache-unsafe.json | 24 +- .../file-backing_basic-cache-writeback.json | 24 +- ...file-backing_basic-cache-writethrough.json | 24 +- .../xml2json/file-raw-aio_native.json | 6 +- ...work-qcow2-backing-chain-cache-unsafe.json | 12 +- .../blkdeviotune-group-num.x86_64-latest.args | 4 +- ...blkdeviotune-max-length.x86_64-latest.args | 4 +- .../blkdeviotune-max.x86_64-latest.args | 4 +- .../blkdeviotune.x86_64-latest.args | 4 +- .../controller-order.x86_64-latest.args | 2 +- .../disk-aio.x86_64-latest.args | 2 +- .../disk-arm-virtio-sd.aarch64-latest.args | 2 + tests/qemuxml2argvdata/disk-arm-virtio-sd.xml | 16 + .../disk-cache.x86_64-latest.args | 10 +- .../disk-error-policy-s390x.s390x-latest.args | 6 +- .../disk-error-policy.x86_64-latest.args | 6 +- .../disk-metadata-cache.x86_64-latest.args | 6 +- .../disk-network-nfs.x86_64-latest.args | 2 +- ...rk-tlsx509-nbd-hostname.x86_64-latest.args | 2 +- ...disk-network-tlsx509-nbd.x86_64-5.2.0.args | 2 +- ...isk-network-tlsx509-nbd.x86_64-latest.args | 2 +- ...isk-network-tlsx509-vxhs.x86_64-5.0.0.args | 6 +- .../disk-nvme.x86_64-latest.args | 2 +- .../disk-shared.x86_64-latest.args | 6 +- .../disk-slices.x86_64-latest.args | 8 +- .../disk-snapshot.x86_64-latest.args | 4 +- .../disk-transient.x86_64-latest.args | 2 +- .../disk-vhostvdpa.x86_64-latest.args | 2 +- .../name-escape.x86_64-latest.args | 2 +- .../user-aliases.x86_64-latest.args | 4 +- ...eo-bochs-display-device.x86_64-latest.args | 2 +- ...-device-pciaddr-default.x86_64-latest.args | 2 +- ...video-qxl-device-vgamem.x86_64-latest.args | 2 +- .../video-qxl-device.x86_64-latest.args | 2 +- ...o-qxl-sec-device-vgamem.x86_64-latest.args | 2 +- .../video-qxl-sec-device.x86_64-latest.args | 2 +- ...eo-ramfb-display-device.x86_64-latest.args | 2 +- ...video-vga-device-vgamem.x86_64-latest.args | 2 +- .../video-vga-device.x86_64-latest.args | 2 +- .../video-virtio-blob-off.x86_64-latest.args | 2 +- .../video-virtio-blob-on.x86_64-latest.args | 2 +- ...video-virtio-gpu-device.x86_64-latest.args | 2 +- ...video-virtio-gpu-sdl-gl.x86_64-latest.args | 2 +- ...deo-virtio-gpu-spice-gl.x86_64-latest.args | 2 +- .../video-virtio-gpu-virgl.x86_64-latest.args | 2 +- .../video-virtio-vga.x86_64-latest.args | 2 +- .../disk-arm-virtio-sd.aarch64-latest.xml | 16 + 63 files changed, 438 insertions(+), 462 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Ján Tomko
-
Peter Krempa