[Libvirt-cim] [PATCH V2 42/48] Fix xml generation algorithm in os_xml()

Xu Wang cngesaint at gmail.com
Mon Oct 28 02:46:11 UTC 2013


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

diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index 046cb62..4bce159 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -2226,11 +2226,21 @@ 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,
+                                            0,
+                                            "os",
+                                            NULL,
+                                            TYPE_NODE,
+                                            0,
+                                            "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