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

[libvirt] [PATCH] fix device hotplug



Hi,
due to some restructuring we free the device structure so devices are
plugged correctly but "dumpxml" fails since the dev structure is already
freed.
Cheers,
 -- Guido
>From ba61f99ed3449cf2fbe44a994bd245425ec6087d Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx sigxcpu org>
Date: Thu, 18 Dec 2008 10:06:37 +0100
Subject: [PATCH] fix device hotplug

---
 src/qemu_driver.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 00c4a40..7389c64 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -3158,14 +3158,14 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
         qemuDriverUnlock(driver);
         qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
                          "%s", _("no domain with matching uuid"));
-        goto cleanup;
+        goto error;
     }
 
     if (!virDomainIsActive(vm)) {
         qemuDriverUnlock(driver);
         qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
                          "%s", _("cannot attach device on inactive domain"));
-        goto cleanup;
+        goto error;
     }
 
     dev = virDomainDeviceDefParse(dom->conn,
@@ -3173,7 +3173,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
                                   vm->def, xml);
     qemuDriverUnlock(driver);
     if (dev == NULL)
-        goto cleanup;
+        goto error;
 
 
     if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
@@ -3193,7 +3193,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
         default:
             qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
                              "%s", _("this disk device type cannot be attached"));
-            goto cleanup;
+            goto error;
         }
     } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
                dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
@@ -3202,14 +3202,17 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
     } else {
         qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
                          "%s", _("this device type cannot be attached"));
-        goto cleanup;
+        goto error;
     }
 
 cleanup:
-    virDomainDeviceDefFree(dev);
     if (vm)
         virDomainObjUnlock(vm);
     return ret;
+
+error:
+    virDomainDeviceDefFree(dev);
+    goto cleanup;
 }
 
 static int qemudDomainDetachPciDiskDevice(virConnectPtr conn,
-- 
1.6.0.2


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