[libvirt] [PATCH] qemu: Fix a regression of attaching device

Osier Yang jyang at redhat.com
Wed Jul 13 15:17:30 UTC 2011


qemuDomainModifyDeviceFlags: Changing "ret" to "0", but don't
reset it to "-1" on failure, it's not good idea to change the value
of "ret" in the codes to do some condition checking. This patch
fix it.
---
 src/qemu/qemu_driver.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0a6b48e..ae11c68 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4892,10 +4892,10 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
                             _("unknown domain modify action %d"), action);
             break;
         }
-    } else
-        ret = 0;
+    }
 
-    if (!ret && (flags & VIR_DOMAIN_AFFECT_LIVE)) {
+    if (!(flags & VIR_DOMAIN_AFFECT_CONFIG) &&
+        (flags & VIR_DOMAIN_AFFECT_LIVE)) {
         /* If dev exists it was created to modify the domain config. Free it. */
         virDomainDeviceDefFree(dev);
         dev = virDomainDeviceDefParse(driver->caps, vm->def, xml,
-- 
1.7.6




More information about the libvir-list mailing list