
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- libxkutil/xmlgen.c | 38 ++++++++++++++++++++++++++++++-------- 1 files changed, 30 insertions(+), 8 deletions(-) diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c index 4c5f731..7678503 100644 --- a/libxkutil/xmlgen.c +++ b/libxkutil/xmlgen.c @@ -2132,12 +2132,13 @@ static char *_xenfv_os_xml(const char *root, struct domain *domain) return NULL; } -static char *_kvm_os_xml(xmlNodePtr root, struct domain *domain) +static char *_kvm_os_xml(const char *root, struct domain *domain) { struct fv_os_info *os = &domain->os_info.fv; - xmlNodePtr tmp; unsigned ret; + CU_DEBUG("Enter _kvm_os_xml()"); + if (os->type == NULL) os->type = strdup("hvm"); @@ -2147,17 +2148,38 @@ static char *_kvm_os_xml(xmlNodePtr root, struct domain *domain) os->bootlist[0] = strdup("hd"); } - tmp = xmlNewChild(root, NULL, BAD_CAST "type", BAD_CAST os->type); - if (tmp == NULL) - return XML_ERROR; + 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; + } if (os->arch) - xmlNewProp(tmp, BAD_CAST "arch", BAD_CAST os->arch); + domain->others = add_node_to_others(domain->others, + 0, + "arch", + os->arch, + TYPE_PROP, + 0, + "type"); if (os->machine) - xmlNewProp(tmp, BAD_CAST "machine", BAD_CAST os->machine); + domain->others = add_node_to_others(domain->others, + 0, + "machine", + os->machine, + TYPE_PROP, + 0, + "type"); - ret = _fv_bootlist_xml(root, os); + ret = _fv_bootlist_xml(root, domain); if (ret == 0) return XML_ERROR; -- 1.7.1