render / rpms / libvirt

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