
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- libxkutil/xmlgen.c | 57 ++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 47 insertions(+), 10 deletions(-) diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c index 91ac44a..b09ee02 100644 --- a/libxkutil/xmlgen.c +++ b/libxkutil/xmlgen.c @@ -1980,10 +1980,11 @@ static char *system_xml(xmlNodePtr root, struct domain *domain) return NULL; } -static char *_xenpv_os_xml(xmlNodePtr root, struct domain *domain) +static char *_xenpv_os_xml(const char *root, struct domain *domain) { struct pv_os_info *os = &domain->os_info.pv; - xmlNodePtr tmp; + + CU_DEBUG("Enter _xenpv_os_xml()"); if (os->type == NULL) os->type = strdup("linux"); @@ -1991,21 +1992,57 @@ static char *_xenpv_os_xml(xmlNodePtr root, struct domain *domain) if (os->kernel == NULL) os->kernel = strdup("/dev/null"); - tmp = xmlNewChild(root, NULL, BAD_CAST "type", BAD_CAST os->type); - if (tmp == NULL) + domain->others = add_node_to_others(domain->others, + 0, + "type", + os->type, + TYPE_NODE, + 0, + root); + + if (domain->others == NULL) { + CU_DEBUG("add node <type> failed."); return XML_ERROR; + } - tmp = xmlNewChild(root, NULL, BAD_CAST "kernel", BAD_CAST os->kernel); - if (tmp == NULL) + domain->others = add_node_to_others(domain->others, + 0, + "kernel", + os->kernel, + TYPE_NODE, + 0, + root); + + if (domain->others == NULL) { + CU_DEBUG("add node <kernel> failed."); return XML_ERROR; + } - tmp = xmlNewChild(root, NULL, BAD_CAST "initrd", BAD_CAST os->initrd); - if (tmp == NULL) + domain->others = add_node_to_others(domain->others, + 0, + "initrd", + os->initrd, + TYPE_NODE, + 0, + root); + + if (domain->others == NULL) { + CU_DEBUG("add node <initrd> failed."); return XML_ERROR; + } - tmp = xmlNewChild(root, NULL, BAD_CAST "cmdline", BAD_CAST os->cmdline); - if (tmp == NULL) + domain->others = add_node_to_others(domain->others, + 0, + "cmdline", + os->cmdline, + TYPE_NODE, + 0, + root); + + if (domain->others == NULL) { + CU_DEBUG("add node <cmdline> failed."); return XML_ERROR; + } return NULL; } -- 1.7.1