Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx> --- src/qemu/qemu_command.c | 2 + src/qemu/qemu_domain.c | 2 + src/vz/vz_utils.c | 3 +- ...csi-disk-max_unmap_size.x86_64-latest.args | 37 +++++++++++++++++++ .../disk-scsi-disk-max_unmap_size.xml | 28 ++++++++++++++ tests/qemuxml2argvtest.c | 1 + 6 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 23810bc067..266a12f1b8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1761,6 +1761,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, unsigned int logical_block_size = disk->blockio.logical_block_size; unsigned int physical_block_size = disk->blockio.physical_block_size; unsigned int discard_granularity = disk->blockio.discard_granularity; + unsigned int max_unmap_size = disk->blockio.max_unmap_size; g_autoptr(virJSONValue) wwn = NULL; g_autofree char *serial = NULL; virTristateSwitch removable = VIR_TRISTATE_SWITCH_ABSENT; @@ -1941,6 +1942,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, "p:logical_block_size", logical_block_size, "p:physical_block_size", physical_block_size, "p:discard_granularity", discard_granularity, + "p:max_unmap_size", max_unmap_size, "A:wwn", &wwn, "p:rotation_rate", disk->rotation_rate, "S:vendor", disk->vendor, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3230bc281d..447b77dc56 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8389,6 +8389,8 @@ qemuDomainDiskChangeSupported(virDomainDiskDef *disk, "blockio physical_block_size", false); CHECK_EQ(blockio.discard_granularity, "blockio discard_granularity", false); + CHECK_EQ(blockio.max_unmap_size, + "blockio max_unmap_size", false); CHECK_EQ(blkdeviotune.total_bytes_sec, "blkdeviotune total_bytes_sec", diff --git a/src/vz/vz_utils.c b/src/vz/vz_utils.c index de707df883..54d67e2ae5 100644 --- a/src/vz/vz_utils.c +++ b/src/vz/vz_utils.c @@ -280,7 +280,8 @@ vzCheckDiskUnsupportedParams(virDomainDiskDef *disk) if (disk->blockio.logical_block_size || disk->blockio.physical_block_size || - disk->blockio.discard_granularity) { + disk->blockio.discard_granularity || + disk->blockio.max_unmap_size) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Setting disk block sizes is not " "supported by vz driver.")); diff --git a/tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.x86_64-latest.args b/tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.x86_64-latest.args new file mode 100644 index 0000000000..4616b3c26e --- /dev/null +++ b/tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.x86_64-latest.args @@ -0,0 +1,37 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \ +-accel tcg \ +-cpu qemu64 \ +-m size=219136k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ +-device '{"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.0","addr":"0x2"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/rhelik.raw","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \ +-device '{"driver":"scsi-hd","bus":"scsi0.0","channel":0,"scsi-id":4,"lun":0,"device_id":"drive-scsi0-0-4-0","drive":"libvirt-1-format","id":"scsi0-0-4-0","bootindex":1,"max_unmap_size":1073741824}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.xml b/tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.xml new file mode 100644 index 0000000000..bf197f9aaf --- /dev/null +++ b/tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.xml @@ -0,0 +1,28 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='/var/lib/libvirt/images/rhelik.raw'/> + <target dev='sda' bus='scsi'/> + <address type='drive' controller='0' bus='0' target='4' unit='0'/> + <blockio max_unmap_size='1073741824'/> + </disk> + <controller type='usb' index='0'/> + <controller type='scsi' index='0' model='virtio-scsi'/> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 534eb9e699..835336a9c6 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1234,6 +1234,7 @@ mymain(void) DO_TEST_CAPS_LATEST("disk-scsi-disk-split"); DO_TEST_CAPS_LATEST("disk-scsi-disk-wwn"); DO_TEST_CAPS_LATEST("disk-scsi-disk-vpd"); + DO_TEST_CAPS_LATEST("disk-scsi-disk-max_unmap_size"); DO_TEST_CAPS_LATEST_PARSE_ERROR("disk-scsi-disk-vpd-build-error"); DO_TEST_CAPS_LATEST("controller-virtio-scsi"); DO_TEST_CAPS_LATEST("disk-sata-device"); -- 2.41.0