[Libvirt-cim] [PATCH 37/47] Fix xml generation algorithm in _fv_bootlist_xml()

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


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

diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index f6d83a6..bd53118 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -1492,17 +1492,30 @@ static char *_xenpv_os_xml(const char *root, struct domain *domain)
         return NULL;
 }
 
-static int _fv_bootlist_xml(xmlNodePtr root, struct fv_os_info *os)
+static int _fv_bootlist_xml(const char *root, struct domain *domain)
 {
         unsigned i;
-        xmlNodePtr tmp;
+        struct fv_os_info *os = &domain->os_info.fv;
+
+        CU_DEBUG("Enter _fv_bootlist_xml()");
 
         for (i = 0; i < os->bootlist_ct; i++) {
-                tmp = xmlNewChild(root, NULL, BAD_CAST "boot", NULL);
-                if (tmp == NULL)
+                domain->others = add_node_to_others(domain->others,
+                                                    "boot",
+                                                    NULL,
+                                                    TYPE_NODE,
+                                                    root);
+
+                if (domain->others == NULL) {
+                        CU_DEBUG("add node <boot> failed.");
                         return 0;
+                }
 
-                xmlNewProp(tmp, BAD_CAST "dev", BAD_CAST os->bootlist[i]);
+                domain->others = add_node_to_others(domain->others,
+                                                    "dev",
+                                                    os->bootlist[i],
+                                                    TYPE_PROP,
+                                                    "boot");
         }
 
         return 1;
-- 
1.7.1




More information about the Libvirt-cim mailing list