]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemuDomainDetachChrDevice: Fix chardev hot-unplug
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 11 May 2015 15:05:21 +0000 (17:05 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 21 May 2015 15:49:02 +0000 (17:49 +0200)
Not every chardev is plugged onto virtio-serial bus. However, the
code introduced in 89e991a2aa36b04 assumes that. Incorrectly.
With previous patches we have three options where a chardev can
be plugged: virtio-serial, USB and PCI. This commit fixes the
detach part. However, since we are not auto allocating USB
addresses yet, I'm just marking the place where appropriate code
should go.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_hotplug.c

index fe58154084ab14c6d3134f36496b61ac4f6beb09..170768b3bfb1c3871e962d2bb42a18d4e33358e7 100644 (file)
@@ -4164,7 +4164,13 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver,
 
     rc = qemuDomainWaitForDeviceRemoval(vm);
     if (rc == 0 || rc == 1) {
-        virDomainVirtioSerialAddrRelease(priv->vioserialaddrs, &tmpChr->info);
+        if (chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI) {
+            qemuDomainReleaseDeviceAddress(vm, &tmpChr->info, NULL);
+        } else if (chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB) {
+            /* XXX */
+        } else {
+            virDomainVirtioSerialAddrRelease(priv->vioserialaddrs, &tmpChr->info);
+        }
         ret = qemuDomainRemoveChrDevice(driver, vm, tmpChr);
     } else {
         ret = 0;