Re: [libvirt] [PATCH] fix device hotplug

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

 



On Thu, Dec 18, 2008 at 10:51:04AM +0000, Daniel P. Berrange wrote:
> On Thu, Dec 18, 2008 at 10:26:07AM +0100, Guido G?nther wrote:
> > Hi,
> > due to some restructuring we free the device structure so devices are
> > plugged correctly but "dumpxml" fails since the dev structure is already
> 
> This is a rather over complicated way of fixing it. Why not just
> do:
> 
>   < cleanup:
>   <    virDomainDeviceDefFree(dev)
>   -----------------
>   > cleanup:
>   >    if (ret < 0)
>   >        virDomainDeviceDefFree(dev);
I somehow prefer to keep the cleanup and error targets different, but
you're right the above is much simpler. Updated patch attached.
 -- Guido
>From 97cb0f8be8bd7f736fac361f464488bfb8abaa1c Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx@xxxxxxxxxxx>
Date: Thu, 18 Dec 2008 10:06:37 +0100
Subject: [PATCH] fix device hotplug

---
 src/qemu_driver.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 00c4a40..dd02c3a 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -3206,7 +3206,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
     }
 
 cleanup:
-    virDomainDeviceDefFree(dev);
+    if (ret < 0)
+        virDomainDeviceDefFree(dev);
     if (vm)
         virDomainObjUnlock(vm);
     return ret;
-- 
1.6.0.2

--
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]