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

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


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

diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index cbc69be..3855443 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -1636,17 +1636,30 @@ 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,
+                                         0,
+                                         "emulator",
+                                         emu->path,
+                                         TYPE_NODE,
+                                         0,
+                                         "devices");
+
+        if (emu->others == NULL) {
+                CU_DEBUG("add node <emulator> failed.");
                 return XML_ERROR;
+        }
 
-        return NULL;
+        emu->others = others_to_xml(root, emu->others, 0, "devices");
+
+        return check_others_active(emu->others);
 }
 
 static const char *graphics_vnc_xml(xmlNodePtr root,
-- 
1.7.1




More information about the Libvirt-cim mailing list