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

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


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

diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index b09ee02..3c4fd30 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -2047,17 +2047,34 @@ 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,
+                                                    0,
+                                                    "boot",
+                                                    NULL,
+                                                    TYPE_NODE,
+                                                    0,
+                                                    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,
+                                                    0,
+                                                    "dev",
+                                                    os->bootlist[i],
+                                                    TYPE_PROP,
+                                                    0,
+                                                    "boot");
         }
 
         return 1;
-- 
1.7.1




More information about the Libvirt-cim mailing list