[Libvirt-cim] [PATCH 31/47] Fix xml generation algorithm in emu_xml()

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


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

diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index 6ab697b..a4094d8 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -1060,15 +1060,29 @@ static const char *mem_xml(xmlNodePtr root, struct domain *dominfo)
 static const char *emu_xml(xmlNodePtr root, struct domain *dominfo)
 {
         struct emu_device *emu;
-        xmlNodePtr tmp;
+
+        CU_DEBUG("Enter emu_xml()");
 
         if (dominfo->dev_emu == NULL)
                 return NULL;
 
         emu = &dominfo->dev_emu->dev.emu;
-        tmp = xmlNewChild(root, NULL, BAD_CAST "emulator", BAD_CAST emu->path);
-        if (tmp == NULL)
+
+        emu->others = add_node_to_others(emu->others,
+                                         "emulator",
+                                         emu->path,
+                                         TYPE_NODE,
+                                         "devices");
+
+        if (emu->others == NULL) {
+                CU_DEBUG("add node <emulator> failed.");
                 return XML_ERROR;
+        }
+
+        emu->others = others_to_xml(root, emu->others, "devices");
+        if (emu->others) {
+                CU_DEBUG("others_to_xml failed.");
+        }
 
         return NULL;
 }
-- 
1.7.1




More information about the Libvirt-cim mailing list