[libvirt] [PATCH 7/7] Do not mask QEMU_CAPS_DEVICE in qemuBuildDriveStr
John Ferlan
jferlan at redhat.com
Thu May 19 21:29:41 UTC 2016
On 05/19/2016 02:59 PM, Ján Tomko wrote:
> For some disk types (XEN, SD), we want to emit the syntax
Removed XEN in patch 4 I thought...
> we used for disks before -device was available even
> if QEMU supports -device.
>
> Use the qemuDiskBusNeedsDeviceArg helper to figure out
> whether to use the old or new syntax.
> ---
> src/qemu/qemu_command.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
The rest seems fine - although connecting the dots between CAPS_DEVICE
and bus != BUS_SD wasn't as obvious... It's the double negative of
qemuDiskBusNeedsDeviceArg to set deviceFlagMasked that caused me to pause.
ACK series with a few touchups.
John
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index a6cc0c9..55326c3 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1106,6 +1106,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
> char *source = NULL;
> int actualType = virStorageSourceGetActualType(disk->src);
> qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
> + bool emitDeviceSyntax = qemuDiskBusNeedsDeviceArg(disk->bus);
>
> if (idx < 0) {
> virReportError(VIR_ERR_INTERNAL_ERROR,
> @@ -1246,7 +1247,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
> }
> VIR_FREE(source);
>
> - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
> + if (emitDeviceSyntax)
> virBufferAddLit(&opt, "if=none");
> else
> virBufferAsprintf(&opt, "if=%s", bus);
> @@ -1263,7 +1264,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
> }
> }
>
> - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
> + if (emitDeviceSyntax) {
> virBufferAsprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias);
> } else {
> if (busid == -1 && unitid == -1) {
> @@ -1916,7 +1917,6 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
> char *optstr;
> unsigned int bootindex = 0;
> virDomainDiskDefPtr disk = def->disks[i];
> - bool deviceFlagMasked = true;
>
> /* PowerPC pseries based VMs do not support floppy device */
> if ((disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) &&
> @@ -1945,15 +1945,9 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
>
> virCommandAddArg(cmd, "-drive");
>
> - if (!qemuDiskBusNeedsDeviceArg(disk->bus)) {
> - virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
> - deviceFlagMasked = true;
> - }
> optstr = qemuBuildDriveStr(disk,
> emitBootindex ? false : !!bootindex,
> qemuCaps);
> - if (deviceFlagMasked)
> - virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE);
> if (!optstr)
> return -1;
> virCommandAddArg(cmd, optstr);
>
More information about the libvir-list
mailing list