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

[Libvir] [PATCH] Fix remote virDomainGetXMLDesc




I was wondering why dumpxml didn't work on remote connections. Turned out to be the same bug that Dan found last week: https://www.redhat.com/archives/libvir-list/2007-June/msg00186.html

The attached patch includes that fix, plus it adds proper error handling into xend_internal.c:xenDaemonDomainDumpXML and related functions.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
Index: src/remote_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/remote_internal.c,v
retrieving revision 1.1
diff -u -r1.1 remote_internal.c
--- src/remote_internal.c	11 Jun 2007 11:43:41 -0000	1.1
+++ src/remote_internal.c	21 Jun 2007 15:16:36 -0000
@@ -2440,6 +2440,7 @@
 static void
 make_nonnull_domain (remote_nonnull_domain *dom_dst, virDomainPtr dom_src)
 {
+    dom_dst->id = dom_src->id;
     dom_dst->name = dom_src->name;
     memcpy (dom_dst->uuid, dom_src->uuid, VIR_UUID_BUFLEN);
 }
Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.122
diff -u -r1.122 xend_internal.c
--- src/xend_internal.c	20 Jun 2007 17:25:39 -0000	1.122
+++ src/xend_internal.c	21 Jun 2007 15:16:39 -0000
@@ -2398,8 +2398,11 @@
     xenUnifiedPrivatePtr priv;
 
     root = sexpr_get(conn, "/xend/domain/%d?detail=1", domid);
-    if (root == NULL)
+    if (root == NULL) {
+        virXendError (conn, VIR_ERR_XEN_CALL,
+                      "xenDaemonDomainDumpXMLByID failed to find this domain");
         return (NULL);
+    }
 
     priv = (xenUnifiedPrivatePtr) conn->privateData;
 
@@ -2417,8 +2420,11 @@
     xenUnifiedPrivatePtr priv;
 
     root = sexpr_get(conn, "/xend/domain/%s?detail=1", name);
-    if (root == NULL)
+    if (root == NULL) {
+        virXendError (conn, VIR_ERR_XEN_CALL,
+                      "xenDaemonDomainDumpXMLByName failed to find this domain");
         return (NULL);
+    }
 
     priv = (xenUnifiedPrivatePtr) conn->privateData;
 
@@ -2451,8 +2457,12 @@
     }
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
 
-    if (domain->id < 0 && priv->xendConfigVersion < 3)
+    if (domain->id < 0 && priv->xendConfigVersion < 3) {
+        virXendError (domain->conn, VIR_ERR_XEN_CALL,
+                      "xenDaemonDomainDumpXML domain ID < 0 and xendConfigVersion < 3");
         return(NULL);
+    }
+
     if (domain->id < 0)
         return xenDaemonDomainDumpXMLByName(domain->conn, domain->name);
     else

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


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