[Libvirt-cim] [PATCH 41/47] Fix xml generation algorithm in os_xml()

Xu Wang gesaint at linux.vnet.ibm.com
Tue Oct 8 06:14:15 UTC 2013


Signed-off-by: Xu Wang <gesaint at linux.vnet.ibm.com>
---
 libxkutil/xmlgen.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index 36593d4..2f9ab5a 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -1639,11 +1639,19 @@ static char *_lxc_os_xml(const char *root, struct domain *domain)
 
 static char *os_xml(xmlNodePtr root, struct domain *domain)
 {
-        xmlNodePtr os;
+        const char *os = "os";
 
-        os = xmlNewChild(root, NULL, BAD_CAST "os", NULL);
-        if (os == NULL)
-                return "Failed to allocate XML memory";
+        CU_DEBUG("Enter os_xml()");
+
+        domain->others = add_node_to_others(domain->others,
+                                            "os",
+                                            NULL,
+                                            TYPE_NODE,
+                                            "domain");
+
+        if (domain->others == NULL) {
+                return "add node <os> failed.";
+        }
 
         if (domain->type == DOMAIN_XENPV)
                 return _xenpv_os_xml(os, domain);
-- 
1.7.1




More information about the Libvirt-cim mailing list