]> xenbits.xensource.com Git - libvirt.git/commitdiff
Assume QEMU_CAPS_DEVICE in qemuBuildDiskDriveCommandLine
authorJán Tomko <jtomko@redhat.com>
Thu, 19 May 2016 17:32:29 +0000 (19:32 +0200)
committerJán Tomko <jtomko@redhat.com>
Fri, 20 May 2016 07:02:58 +0000 (09:02 +0200)
We no longer need to handle -usbdevice and the withDeviceArg
logic becomes clearer.

src/qemu/qemu_command.c

index bb40c17cca5932d916a567a552d1139652305430..c0d11b2d654fab56c6e5dc8506ade28b044949b2 100644 (file)
@@ -1907,22 +1907,6 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
         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;
-        }
-
         /* PowerPC pseries based VMs do not support floppy device */
         if ((disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) &&
             ARCH_IS_PPC64(def->os.arch) &&
@@ -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,