[libvirt PATCH 3/3] qemu: use QEMU_CAPS_STORAGE_WERROR for disk-error attributes

Ján Tomko jtomko at redhat.com
Wed Apr 1 09:35:19 UTC 2020


When moving the formatting of this attributes from -drive
to -device, the QEMU_CAPS_USB_STORAGE_WERROR capability
was used, because usb-storage was the last device to gain
this capability.

However this lead to the assumption that QEMU binaries
without the usb-storage device do not support this,
leading to breakage on s390x with blockdev.

Fixes: bb4f3543bbf3ebbffa833ae7df55c298920243eb
https://bugzilla.redhat.com/show_bug.cgi?id=1819250

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/qemu/qemu_command.c                              |  4 ++--
 .../disk-error-policy-s390x.s390x-2.12.0.args        | 12 ++++++------
 .../disk-error-policy-s390x.s390x-latest.args        | 12 ++++++------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d1b689dfd3..2f0e919cc1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1790,7 +1790,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
 
     /* werror/rerror are really frontend attributes, but older
      * qemu requires them on -drive instead of -device */
-    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_WERROR))
+    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_STORAGE_WERROR))
         qemuBuildDiskFrontendAttributeErrorPolicy(disk, &opt);
 
     if (disk->src->readonly)
@@ -2241,7 +2241,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
 
     qemuBuildDiskFrontendAttributes(disk, &opt);
 
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_WERROR))
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_STORAGE_WERROR))
         qemuBuildDiskFrontendAttributeErrorPolicy(disk, &opt);
 
     return virBufferContentAndReset(&opt);
diff --git a/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-2.12.0.args b/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-2.12.0.args
index cf932d1fad..6b93b74ec1 100644
--- a/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-2.12.0.args
+++ b/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-2.12.0.args
@@ -26,17 +26,17 @@ file=/tmp/lib/domain--1-guest/master-key.aes \
 -no-shutdown \
 -boot strict=on \
 -drive file=/var/images/image1,format=qcow2,if=none,id=drive-virtio-disk0,\
-werror=stop,rerror=stop,cache=none \
+cache=none \
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0000,drive=drive-virtio-disk0,\
-id=virtio-disk0,bootindex=1,write-cache=on \
+id=virtio-disk0,bootindex=1,write-cache=on,werror=stop,rerror=stop \
 -drive file=/var/images/image2,format=qcow2,if=none,id=drive-virtio-disk1,\
-werror=enospc,cache=none \
+cache=none \
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0001,drive=drive-virtio-disk1,\
-id=virtio-disk1,write-cache=on \
+id=virtio-disk1,write-cache=on,werror=enospc \
 -drive file=/var/images/image3,format=qcow2,if=none,id=drive-virtio-disk2,\
-werror=report,rerror=ignore,cache=none \
+cache=none \
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0002,drive=drive-virtio-disk2,\
-id=virtio-disk2,write-cache=on \
+id=virtio-disk2,write-cache=on,werror=report,rerror=ignore \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args b/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args
index 7daddc1d87..0d9254e1ae 100644
--- a/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args
+++ b/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args
@@ -27,17 +27,17 @@ file=/tmp/lib/domain--1-guest/master-key.aes \
 -no-shutdown \
 -boot strict=on \
 -drive file=/var/images/image1,format=qcow2,if=none,id=drive-virtio-disk0,\
-werror=stop,rerror=stop,cache=none \
+cache=none \
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0000,drive=drive-virtio-disk0,\
-id=virtio-disk0,bootindex=1,write-cache=on \
+id=virtio-disk0,bootindex=1,write-cache=on,werror=stop,rerror=stop \
 -drive file=/var/images/image2,format=qcow2,if=none,id=drive-virtio-disk1,\
-werror=enospc,cache=none \
+cache=none \
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0001,drive=drive-virtio-disk1,\
-id=virtio-disk1,write-cache=on \
+id=virtio-disk1,write-cache=on,werror=enospc \
 -drive file=/var/images/image3,format=qcow2,if=none,id=drive-virtio-disk2,\
-werror=report,rerror=ignore,cache=none \
+cache=none \
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0002,drive=drive-virtio-disk2,\
-id=virtio-disk2,write-cache=on \
+id=virtio-disk2,write-cache=on,werror=report,rerror=ignore \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -msg timestamp=on
-- 
2.25.1




More information about the libvir-list mailing list