Signed-off-by: Xu Wang <gesaint(a)linux.vnet.ibm.com>
---
libxkutil/xmlgen.c | 39 ++++++++++++++++++++++++---------------
1 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index ed00386..6ab697b 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -1010,10 +1010,11 @@ static const char *cputune_xml(xmlNodePtr root, struct domain
*dominfo)
static const char *mem_xml(xmlNodePtr root, struct domain *dominfo)
{
struct mem_device *mem;
- xmlNodePtr tmp = NULL;
int ret;
char *string = NULL;
+ CU_DEBUG("Enter mem_xml()");
+
if (dominfo->dev_mem == NULL)
return NULL;
@@ -1022,30 +1023,38 @@ static const char *mem_xml(xmlNodePtr root, struct domain
*dominfo)
ret = asprintf(&string, "%" PRIu64, mem->size);
if (ret == -1)
goto out;
- tmp = xmlNewChild(root,
- NULL,
- BAD_CAST "currentMemory",
- BAD_CAST string);
- if (tmp == NULL)
+
+ mem->others = add_node_to_others(mem->others,
+ "currentMemory",
+ string,
+ TYPE_NODE,
+ "domain");
+
+ if (mem->others == NULL) {
+ CU_DEBUG("add node <currentMemory> failed.");
return XML_ERROR;
+ }
free(string);
- tmp = NULL;
ret = asprintf(&string, "%" PRIu64, mem->maxsize);
if (ret == -1)
goto out;
- tmp = xmlNewChild(root,
- NULL,
- BAD_CAST "memory",
- BAD_CAST string);
+
+ mem->others = add_node_to_others(mem->others,
+ "memory",
+ string,
+ TYPE_NODE,
+ "domain");
free(string);
+
+ dominfo->others = combine_others(dominfo->others, mem->others);
+ mem->others = NULL;
+
+ return NULL;
out:
- if (tmp == NULL)
- return XML_ERROR;
- else
- return NULL;
+ return XML_ERROR;
}
static const char *emu_xml(xmlNodePtr root, struct domain *dominfo)
--
1.7.1