]> xenbits.xensource.com Git - libvirt.git/commitdiff
hotplug: Check for alias in hostdev detach
authorJohn Ferlan <jferlan@redhat.com>
Wed, 8 Oct 2014 22:45:39 +0000 (18:45 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 29 Oct 2014 01:12:08 +0000 (21:12 -0400)
If the QEMU_CAPS_DEVICE is set, then ensure the host device alias has
been properly set before making the calls to detach the device

src/qemu/qemu_hotplug.c

index 3e8cdbfc626df88c6d5058cef3aae129c5f4e71f..db39948a3cfcbbe6a154ce841c625c69d643a869 100644 (file)
@@ -3371,8 +3371,15 @@ qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver,
                                virDomainObjPtr vm,
                                virDomainHostdevDefPtr detach)
 {
+    qemuDomainObjPrivatePtr priv = vm->privateData;
     int ret = -1;
 
+    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+        !detach->info->alias) {
+        if (qemuAssignDeviceHostdevAlias(vm->def, detach, -1) < 0)
+            return -1;
+    }
+
     switch (detach->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
         ret = qemuDomainDetachHostPCIDevice(driver, vm, detach);