Signed-off-by: Xu Wang <gesaint(a)linux.vnet.ibm.com>
---
libxkutil/xmlgen.c | 38 ++++++++++++++++++++++++++++----------
1 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index 46bd8f4..8e793f9 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -1509,19 +1509,29 @@ static const char *vcpu_xml(xmlNodePtr root, struct domain
*dominfo)
static const char *cputune_xml(xmlNodePtr root, struct domain *dominfo)
{
struct vcpu_device *vcpu;
- xmlNodePtr cputune, tmp;
int ret;
char *string = NULL;
+ CU_DEBUG("Enter cputune_xml()");
+
if (dominfo->dev_vcpu == NULL)
return NULL;
vcpu = &dominfo->dev_vcpu[0].dev.vcpu;
/* CPU cgroup setting saved by libvirt under <cputune> XML section */
- cputune = xmlNewChild(root, NULL, BAD_CAST "cputune", NULL);
- if (cputune == NULL)
+ vcpu->others = add_node_to_others(vcpu->others,
+ 0,
+ "cputune",
+ NULL,
+ TYPE_NODE,
+ 0,
+ "domain");
+
+ if (vcpu->others == NULL) {
+ CU_DEBUG("add node <cputune> failed.");
return XML_ERROR;
+ }
/* Get the CPU cgroup setting from the VCPU RASD.Weight property */
ret = asprintf(&string,
@@ -1530,16 +1540,24 @@ static const char *cputune_xml(xmlNodePtr root, struct domain
*dominfo)
if (ret == -1)
return XML_ERROR;
- tmp = xmlNewChild(cputune,
- NULL,
- BAD_CAST "shares",
- BAD_CAST string);
+ vcpu->others = add_node_to_others(vcpu->others,
+ 0,
+ "shares",
+ string,
+ TYPE_NODE,
+ 0,
+ "cputune");
free(string);
- if (tmp == NULL)
+ if (vcpu->others == NULL) {
+ CU_DEBUG("add node <shares> failed.");
return XML_ERROR;
- else
- return NULL;
+ }
+
+ dominfo->others = combine_others(dominfo->others, vcpu->others);
+ vcpu->others = NULL;
+
+ return NULL;
}
#endif
--
1.7.1