[libvirt] [PATCH 5/7] Assume QEMU_CAPS_DEVICE in qemuBuildDiskDriveCommandLine

John Ferlan jferlan at redhat.com
Thu May 19 21:24:57 UTC 2016



On 05/19/2016 02:59 PM, Ján Tomko wrote:
> We no longer need to handle -usbdevice and the withDeviceArg
> logic becomes clearer.
> ---
>  src/qemu/qemu_command.c | 30 ++++++------------------------
>  1 file changed, 6 insertions(+), 24 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index bb40c17..0bde505 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1905,23 +1905,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
>          unsigned int bootindex = 0;
>          virDomainDiskDefPtr disk = def->disks[i];
>          bool withDeviceArg = false;
> -        bool deviceFlagMasked = false;
> -
> -        /* Unless we have -device, then USB disks need special
> -           handling */
> -        if ((disk->bus == VIR_DOMAIN_DISK_BUS_USB) &&
> -            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
> -            if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
> -                virCommandAddArg(cmd, "-usbdevice");
> -                virCommandAddArgFormat(cmd, "disk:%s", disk->src->path);
> -            } else {
> -                virReportError(VIR_ERR_INTERNAL_ERROR,
> -                               _("unsupported usb disk type for '%s'"),
> -                               disk->src->path);
> -                return -1;
> -            }
> -            continue;
> -        }
> +        bool deviceFlagMasked = true;

I know this goes away by patch 7, but there's nothing later on that sets
this to false - so it seems it should be kept as false for now...

John
>  
>          /* PowerPC pseries based VMs do not support floppy device */
>          if ((disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) &&
> @@ -1955,13 +1939,11 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
>             devices. Fortunately, those don't need
>             static PCI addresses, so we don't really
>             care that we can't use -device */
> -        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
> -            if (disk->bus != VIR_DOMAIN_DISK_BUS_SD) {
> -                withDeviceArg = true;
> -            } else {
> -                virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
> -                deviceFlagMasked = true;
> -            }
> +        if (disk->bus != VIR_DOMAIN_DISK_BUS_SD) {
> +            withDeviceArg = true;
> +        } else {
> +            virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
> +            deviceFlagMasked = true;
>          }
>          optstr = qemuBuildDriveStr(disk,
>                                     emitBootindex ? false : !!bootindex,
> 




More information about the libvir-list mailing list