[libvirt] [PATCH 4/4] qemu: command: Format rerror/werror with -device instead of -drive

Peter Krempa pkrempa at redhat.com
Mon Jul 9 15:56:24 UTC 2018


Use the new proper location for the read/write error policy selection.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_command.c                                      |  6 +++++-
 .../disk-drive-error-policy.x86_64-latest.args               | 12 ++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3c1e87fad4..7fd2c8b372 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1664,7 +1664,8 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,

     /* werror/rerror are really frontend attributes, but older
      * qemu requires them on -drive instead of -device */
-    qemuBuildDiskFrontendAttributeErrorPolicy(disk, &opt);
+    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_WERROR))
+        qemuBuildDiskFrontendAttributeErrorPolicy(disk, &opt);


     /* While this is a frontend attribute, it only makes sense to be used when
@@ -2126,6 +2127,9 @@ qemuBuildDriveDevStr(const virDomainDef *def,

     qemuBuildDiskFrontendAttributes(disk, &opt);

+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_WERROR))
+        qemuBuildDiskFrontendAttributeErrorPolicy(disk, &opt);
+
     if (virBufferCheckError(&opt) < 0)
         goto error;

diff --git a/tests/qemuxml2argvdata/disk-drive-error-policy.x86_64-latest.args b/tests/qemuxml2argvdata/disk-drive-error-policy.x86_64-latest.args
index 388f78df0f..e8fa9e2452 100644
--- a/tests/qemuxml2argvdata/disk-drive-error-policy.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-drive-error-policy.x86_64-latest.args
@@ -25,17 +25,17 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -boot strict=on \
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
 -drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-ide0-0-0,\
-werror=stop,rerror=stop,cache=none \
+cache=none \
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1,\
-write-cache=on \
+write-cache=on,werror=stop,rerror=stop \
 -drive file=/dev/HostVG/QEMUGuest2,format=qcow2,if=none,id=drive-ide0-0-1,\
-werror=enospc,cache=none \
+cache=none \
 -device ide-hd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1,\
-write-cache=on \
+write-cache=on,werror=enospc \
 -drive file=/dev/HostVG/QEMUGuest3,format=qcow2,if=none,id=drive-ide0-1-0,\
-werror=report,rerror=ignore,cache=none \
+cache=none \
 -device ide-hd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,\
-write-cache=on \
+write-cache=on,werror=report,rerror=ignore \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -msg timestamp=on
-- 
2.16.2




More information about the libvir-list mailing list