[PATCH 12/13] qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachControllerDevice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/qemu/qemu_hotplug.c | 56 +++++++++++++++++++++----------------------------
 1 file changed, 24 insertions(+), 32 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index b0e1e4d..ca7cd84 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -435,47 +435,39 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
         return -1;
     }

-    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
-        if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
-            if (qemuDomainMachineIsS390CCW(vm->def) &&
-                virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW))
-                controller->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
-            else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390))
-                controller->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390;
-        } else {
-            if (!qemuCheckCCWS390AddressSupport(vm->def, controller->info,
-                                                priv->qemuCaps, "controller"))
-                goto cleanup;
-        }
-
-        if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
-            controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
-            if (virDomainPCIAddressEnsureAddr(priv->pciaddrs, &controller->info) < 0)
-                goto cleanup;
-        } else if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
-            if (virDomainCCWAddressAssign(&controller->info, priv->ccwaddrs,
-                                          !controller->info.addr.ccw.assigned) < 0)
-                goto cleanup;
-        }
-        releaseaddr = true;
-        if (qemuAssignDeviceControllerAlias(vm->def, priv->qemuCaps, controller) < 0)
+    if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
+        if (qemuDomainMachineIsS390CCW(vm->def) &&
+            virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW))
+            controller->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
+        else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390))
+            controller->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390;
+    } else {
+        if (!qemuCheckCCWS390AddressSupport(vm->def, controller->info,
+                                            priv->qemuCaps, "controller"))
             goto cleanup;
+    }

-        if (!(devstr = qemuBuildControllerDevStr(vm->def, controller, priv->qemuCaps, NULL)))
+    if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
+        controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
+        if (virDomainPCIAddressEnsureAddr(priv->pciaddrs, &controller->info) < 0)
+            goto cleanup;
+    } else if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
+        if (virDomainCCWAddressAssign(&controller->info, priv->ccwaddrs,
+                                      !controller->info.addr.ccw.assigned) < 0)
             goto cleanup;
     }
+    releaseaddr = true;
+    if (qemuAssignDeviceControllerAlias(vm->def, priv->qemuCaps, controller) < 0)
+        goto cleanup;
+
+    if (!(devstr = qemuBuildControllerDevStr(vm->def, controller, priv->qemuCaps, NULL)))
+        goto cleanup;

     if (VIR_REALLOC_N(vm->def->controllers, vm->def->ncontrollers+1) < 0)
         goto cleanup;

     qemuDomainObjEnterMonitor(driver, vm);
-    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
-        ret = qemuMonitorAddDevice(priv->mon, devstr);
-    } else {
-        ret = qemuMonitorAttachPCIDiskController(priv->mon,
-                                                 type,
-                                                 &controller->info.addr.pci);
-    }
+    ret = qemuMonitorAddDevice(priv->mon, devstr);
     if (qemuDomainObjExitMonitor(driver, vm) < 0) {
         releaseaddr = false;
         ret = -1;
-- 
2.8.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]