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

Peter Krempa posted 12 patches 7 years, 5 months ago
[libvirt] [PATCH 02/12] qemu: command: Format frontend props with -device rather than -drive
Posted by Peter Krempa 7 years, 5 months ago
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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 02/12] qemu: command: Format frontend props with -device rather than -drive
Posted by Peter Krempa 7 years, 5 months ago
On Mon, Nov 20, 2017 at 18:25:19 +0100, Peter Krempa wrote:
> 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(-)

So, SNACK to this. Qemu moved the parameters at some time but this does
not do any capability checking so it may have broken older qemus.

I'll strip this patch and the fallout from this series and just send the
refactors. Later on I'll conditionally enable this when we start using
-blockdev and thus these would be lost.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list