# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1200443079 28800
# Node ID 05fa2ceba145e9e93066bd66c74299680bd7d21d
# Parent b7e3377230c2c32de24a9b267889bcce183af2ba
Add VCPU XML generation
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r b7e3377230c2 -r 05fa2ceba145 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Tue Jan 15 16:24:37 2008 -0800
+++ b/libxkutil/xmlgen.c Tue Jan 15 16:24:39 2008 -0800
@@ -197,8 +197,21 @@ static bool net_to_xml(char **xml, struc
static bool vcpu_to_xml(char **xml, struct virt_device *dev)
{
- astrcat(xml, "<vcpu>1</vcpu>\n");
- return true;
+ int count;
+ int ret;
+
+ if (*xml == NULL) {
+ ret = asprintf(xml, "<vcpu>1</vcpu>");
+ return ret != -1;
+ }
+
+ if (sscanf(*xml, "<vcpu>%i</vcpu>\n", &count) != 1)
+ return false;
+
+ free(*xml);
+ ret = asprintf(xml, "<vcpu>%i</vcpu>\n", count + 1);
+
+ return ret != -1;
}
static bool mem_to_xml(char **xml, struct virt_device *dev)