b971b8
From 94f0a246fd5e53d24feff99704fca0e812c3f50d Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <94f0a246fd5e53d24feff99704fca0e812c3f50d@dist-git>
b971b8
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
b971b8
Date: Wed, 1 Apr 2020 17:19:27 +0200
b971b8
Subject: [PATCH] qemu: use QEMU_CAPS_STORAGE_WERROR for disk-error attributes
b971b8
MIME-Version: 1.0
b971b8
Content-Type: text/plain; charset=UTF-8
b971b8
Content-Transfer-Encoding: 8bit
b971b8
b971b8
When moving the formatting of this attributes from -drive
b971b8
to -device, the QEMU_CAPS_USB_STORAGE_WERROR capability
b971b8
was used, because usb-storage was the last device to gain
b971b8
this capability.
b971b8
b971b8
However this lead to the assumption that QEMU binaries
b971b8
without the usb-storage device do not support this,
b971b8
leading to breakage on s390x with blockdev.
b971b8
b971b8
Fixes: bb4f3543bbf3ebbffa833ae7df55c298920243eb
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1819250
b971b8
b971b8
Signed-off-by: Ján Tomko <jtomko@redhat.com>
b971b8
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
b971b8
(cherry picked from commit 29fc9e96a9db30000137e648b775b6b08e05d43b)
b971b8
Signed-off-by: Ján Tomko <jtomko@redhat.com>
b971b8
Message-Id: <890258bf43d483173d07687f2eff72c03a243580.1585754141.git.jtomko@redhat.com>
b971b8
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
b971b8
---
b971b8
 src/qemu/qemu_command.c                              |  4 ++--
b971b8
 .../disk-error-policy-s390x.s390x-2.12.0.args        | 12 ++++++------
b971b8
 .../disk-error-policy-s390x.s390x-latest.args        | 12 ++++++------
b971b8
 3 files changed, 14 insertions(+), 14 deletions(-)
b971b8
b971b8
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
b971b8
index de97504ce1..4653e6ac3c 100644
b971b8
--- a/src/qemu/qemu_command.c
b971b8
+++ b/src/qemu/qemu_command.c
b971b8
@@ -1805,7 +1805,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
b971b8
 
b971b8
     /* werror/rerror are really frontend attributes, but older
b971b8
      * qemu requires them on -drive instead of -device */
b971b8
-    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_WERROR))
b971b8
+    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_STORAGE_WERROR))
b971b8
         qemuBuildDiskFrontendAttributeErrorPolicy(disk, &opt;;
b971b8
 
b971b8
     if (disk->src->readonly)
b971b8
@@ -2256,7 +2256,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
b971b8
 
b971b8
     qemuBuildDiskFrontendAttributes(disk, &opt;;
b971b8
 
b971b8
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_WERROR))
b971b8
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_STORAGE_WERROR))
b971b8
         qemuBuildDiskFrontendAttributeErrorPolicy(disk, &opt;;
b971b8
 
b971b8
     return virBufferContentAndReset(&opt;;
b971b8
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
b971b8
index cf932d1fad..6b93b74ec1 100644
b971b8
--- a/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-2.12.0.args
b971b8
+++ b/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-2.12.0.args
b971b8
@@ -26,17 +26,17 @@ file=/tmp/lib/domain--1-guest/master-key.aes \
b971b8
 -no-shutdown \
b971b8
 -boot strict=on \
b971b8
 -drive file=/var/images/image1,format=qcow2,if=none,id=drive-virtio-disk0,\
b971b8
-werror=stop,rerror=stop,cache=none \
b971b8
+cache=none \
b971b8
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0000,drive=drive-virtio-disk0,\
b971b8
-id=virtio-disk0,bootindex=1,write-cache=on \
b971b8
+id=virtio-disk0,bootindex=1,write-cache=on,werror=stop,rerror=stop \
b971b8
 -drive file=/var/images/image2,format=qcow2,if=none,id=drive-virtio-disk1,\
b971b8
-werror=enospc,cache=none \
b971b8
+cache=none \
b971b8
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0001,drive=drive-virtio-disk1,\
b971b8
-id=virtio-disk1,write-cache=on \
b971b8
+id=virtio-disk1,write-cache=on,werror=enospc \
b971b8
 -drive file=/var/images/image3,format=qcow2,if=none,id=drive-virtio-disk2,\
b971b8
-werror=report,rerror=ignore,cache=none \
b971b8
+cache=none \
b971b8
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0002,drive=drive-virtio-disk2,\
b971b8
-id=virtio-disk2,write-cache=on \
b971b8
+id=virtio-disk2,write-cache=on,werror=report,rerror=ignore \
b971b8
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
b971b8
 resourcecontrol=deny \
b971b8
 -msg timestamp=on
b971b8
diff --git a/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args b/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args
b971b8
index 5748ad7823..b1604675a1 100644
b971b8
--- a/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args
b971b8
+++ b/tests/qemuxml2argvdata/disk-error-policy-s390x.s390x-latest.args
b971b8
@@ -26,17 +26,17 @@ file=/tmp/lib/domain--1-guest/master-key.aes \
b971b8
 -no-shutdown \
b971b8
 -boot strict=on \
b971b8
 -drive file=/var/images/image1,format=qcow2,if=none,id=drive-virtio-disk0,\
b971b8
-werror=stop,rerror=stop,cache=none \
b971b8
+cache=none \
b971b8
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0000,drive=drive-virtio-disk0,\
b971b8
-id=virtio-disk0,bootindex=1,write-cache=on \
b971b8
+id=virtio-disk0,bootindex=1,write-cache=on,werror=stop,rerror=stop \
b971b8
 -drive file=/var/images/image2,format=qcow2,if=none,id=drive-virtio-disk1,\
b971b8
-werror=enospc,cache=none \
b971b8
+cache=none \
b971b8
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0001,drive=drive-virtio-disk1,\
b971b8
-id=virtio-disk1,write-cache=on \
b971b8
+id=virtio-disk1,write-cache=on,werror=enospc \
b971b8
 -drive file=/var/images/image3,format=qcow2,if=none,id=drive-virtio-disk2,\
b971b8
-werror=report,rerror=ignore,cache=none \
b971b8
+cache=none \
b971b8
 -device virtio-blk-ccw,scsi=off,devno=fe.0.0002,drive=drive-virtio-disk2,\
b971b8
-id=virtio-disk2,write-cache=on \
b971b8
+id=virtio-disk2,write-cache=on,werror=report,rerror=ignore \
b971b8
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
b971b8
 resourcecontrol=deny \
b971b8
 -msg timestamp=on
b971b8
-- 
b971b8
2.26.2
b971b8