+Wed Feb 7 07:43:21 EST 2007 Daniel Berrange <berrange@redhat.com>
+
+ * src/xml.c, tests/xml2sexprdata/*.sexpr: Also include the
+ vcpu info in the (image (hvm)) part of the SEXPR for fully
+ virt guests, so it gets passed on into QEMU.
+
Wed Feb 7 07:40:21 EST 2007 Daniel Berrange <berrange@redhat.com>
* configure.in, tests/Makefile.am: Only enable the low level
* @node: node containing HVM OS description
* @buf: a buffer for the result S-Expr
* @ctxt: a path context representing the XML description
+ * @vcpus: number of virtual CPUs to configure
* @xendConfigVersion: xend configuration file format
*
* Parse the OS part of the XML description for an HVM domain and add it to
* Returns 0 in case of success, -1 in case of error.
*/
static int
-virDomainParseXMLOSDescHVM(xmlNodePtr node, virBufferPtr buf, xmlXPathContextPtr ctxt, int xendConfigVersion)
+virDomainParseXMLOSDescHVM(xmlNodePtr node, virBufferPtr buf, xmlXPathContextPtr ctxt, int vcpus, int xendConfigVersion)
{
xmlXPathObjectPtr obj = NULL;
xmlNodePtr cur, txt;
xmlXPathFreeObject(obj);
obj = NULL;
+ virBufferVSprintf(buf, "(vcpus %d)", vcpus);
+
if (boot_dev) {
if (xmlStrEqual(boot_dev, BAD_CAST "fd")) {
virBufferVSprintf(buf, "(boot a)", (const char *) boot_dev);
int i, res;
int bootloader = 0;
int hvm = 0;
+ unsigned int vcpus = 1;
unsigned long mem = 0, max_mem = 0;
if (name != NULL)
virBufferVSprintf(&buf, "(memory %lu)(maxmem %lu)", mem, max_mem);
obj = xmlXPathEval(BAD_CAST "number(/domain/vcpu[1])", ctxt);
- if ((obj == NULL) || (obj->type != XPATH_NUMBER) ||
- (isnan(obj->floatval)) || (obj->floatval <= 0)) {
- virBufferVSprintf(&buf, "(vcpus 1)");
- } else {
- unsigned int cpu = (unsigned int) obj->floatval;
-
- virBufferVSprintf(&buf, "(vcpus %u)", cpu);
+ if ((obj != NULL) && (obj->type == XPATH_NUMBER) &&
+ (!isnan(obj->floatval)) && (obj->floatval > 0)) {
+ vcpus = (unsigned int) obj->floatval;
}
+ virBufferVSprintf(&buf, "(vcpus %u)", vcpus);
xmlXPathFreeObject(obj);
obj = xmlXPathEval(BAD_CAST "string(/domain/uuid[1])", ctxt);
} else {
hvm = 1;
res = virDomainParseXMLOSDescHVM(obj->nodesetval->nodeTab[0],
- &buf, ctxt, xendConfigVersion);
+ &buf, ctxt, vcpus, xendConfigVersion);
}
xmlXPathFreeObject(tmpobj);