[libvirt] [PATCH] test driver: Fix domain ID after redefining a running VM

Cole Robinson crobinso at redhat.com
Thu Jun 18 16:35:40 UTC 2009


The ID of the existing VM was being unconditionally set to -1, which was
upsetting virt-manager.

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/test.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/test.c b/src/test.c
index 7dc0840..2a672a3 100644
--- a/src/test.c
+++ b/src/test.c
@@ -1623,16 +1623,16 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn,
                                   def)) == NULL) {
         goto cleanup;
     }
+    def = NULL;
     dom->persistent = 1;
-    dom->def->id = -1;
+
     event = virDomainEventNewFromObj(dom,
                                      VIR_DOMAIN_EVENT_DEFINED,
                                      VIR_DOMAIN_EVENT_DEFINED_ADDED);
 
-    ret = virGetDomain(conn, def->name, def->uuid);
-    def = NULL;
+    ret = virGetDomain(conn, dom->def->name, dom->def->uuid);
     if (ret)
-        ret->id = -1;
+        ret->id = dom->def->id;
 
 cleanup:
     virDomainDefFree(def);
-- 
1.6.0.6




More information about the libvir-list mailing list