[libvirt] [PATCH 02/12] qemu: command: Format frontend props with -device rather than -drive

Peter Krempa pkrempa at redhat.com
Mon Nov 20 17:25:19 UTC 2017


Historically we've formatted a lot of the attributes of a disk (disk
geometry, etc) with -drive. Since we use -device now, they should be
formatted there.
---
 src/qemu/qemu_command.c                                | 5 ++++-
 tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.args | 6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9dac68981a..8c7bb245ed 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1689,7 +1689,8 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
     if (disk->src->readonly)
         virBufferAddLit(&opt, ",readonly=on");

-    qemuBuildDiskFrontendAttributes(disk, &opt);
+    if (!emitDeviceSyntax)
+        qemuBuildDiskFrontendAttributes(disk, &opt);

     if (disk->serial &&
         virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL)) {
@@ -2124,6 +2125,8 @@ qemuBuildDriveDevStr(const virDomainDef *def,
                               disk->blockio.physical_block_size);
     }

+    qemuBuildDiskFrontendAttributes(disk, &opt);
+
     if (disk->wwn) {
         if (STRPREFIX(disk->wwn, "0x"))
             virBufferAsprintf(&opt, ",wwn=%s", disk->wwn);
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.args
index 3badaae28c..2b92dde39f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.args
@@ -19,7 +19,7 @@ server,nowait \
 -no-acpi \
 -boot c \
 -usb \
--drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0,\
-cyls=16383,heads=16,secs=63,trans=lba \
--device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,cyls=16383,\
+heads=16,secs=63,trans=lba \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
-- 
2.14.3




More information about the libvir-list mailing list