* src/xml.c: patch for rhbz#214741, when using pygrub

do not push the os image information for domain creation
  via xend
Daniel
This commit is contained in:
Daniel Veillard 2006-11-27 23:16:59 +00:00
parent 1bd41d0bab
commit e1f2b6497e
4 changed files with 472 additions and 410 deletions

View File

@ -1,3 +1,9 @@
Mon Nov 27 23:27:26 CET 2006 Daniel Veillard <veillard@redhat.com>
* src/xml.c: patch for rhbz#214741, when using pygrub
do not push the os image information for domain creation
via xend
Wed Nov 22 17:57:58 CET 2006 Daniel Veillard <veillard@redhat.com> Wed Nov 22 17:57:58 CET 2006 Daniel Veillard <veillard@redhat.com>
* docs//*: regenerated * docs//*: regenerated

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1314,7 +1314,14 @@ virDomainParseXMLDesc(const char *xmldesc, char **name, int xendConfigVersion)
if ((obj != NULL) && (obj->type == XPATH_STRING) && if ((obj != NULL) && (obj->type == XPATH_STRING) &&
(obj->stringval != NULL) && (obj->stringval[0] != 0)) { (obj->stringval != NULL) && (obj->stringval[0] != 0)) {
virBufferVSprintf(&buf, "(bootloader '%s')", obj->stringval); virBufferVSprintf(&buf, "(bootloader '%s')", obj->stringval);
bootloader = 1; /*
* if using pygrub, the kernel and initrd strings are not
* significant and should be discarded
*/
if (xmlStrstr(obj->stringval, BAD_CAST "pygrub"))
bootloader = 2;
else
bootloader = 1;
} }
xmlXPathFreeObject(obj); xmlXPathFreeObject(obj);
@ -1339,35 +1346,40 @@ virDomainParseXMLDesc(const char *xmldesc, char **name, int xendConfigVersion)
} }
xmlXPathFreeObject(obj); xmlXPathFreeObject(obj);
obj = xmlXPathEval(BAD_CAST "/domain/os[1]", ctxt); if (bootloader != 2) {
if ((obj != NULL) && (obj->type == XPATH_NODESET) && obj = xmlXPathEval(BAD_CAST "/domain/os[1]", ctxt);
(obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) { if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
/* Analyze of the os description, based on HVM or PV. */ (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) {
tmpobj = xmlXPathEval(BAD_CAST "string(/domain/os/type[1])", ctxt); /* Analyze of the os description, based on HVM or PV. */
if ((tmpobj != NULL) && tmpobj = xmlXPathEval(BAD_CAST "string(/domain/os/type[1])", ctxt);
((tmpobj->type != XPATH_STRING) || (tmpobj->stringval == NULL) || if ((tmpobj != NULL) &&
(tmpobj->stringval[0] == 0))) { ((tmpobj->type != XPATH_STRING) || (tmpobj->stringval == NULL)
|| (tmpobj->stringval[0] == 0))) {
xmlXPathFreeObject(tmpobj);
virXMLError(VIR_ERR_OS_TYPE, nam, 0);
goto error;
}
if ((tmpobj == NULL)
|| !xmlStrEqual(tmpobj->stringval, BAD_CAST "hvm")) {
res = virDomainParseXMLOSDescPV(obj->nodesetval->nodeTab[0],
&buf, ctxt, xendConfigVersion);
} else {
hvm = 1;
res = virDomainParseXMLOSDescHVM(obj->nodesetval->nodeTab[0],
&buf, ctxt, xendConfigVersion);
}
xmlXPathFreeObject(tmpobj); xmlXPathFreeObject(tmpobj);
virXMLError(VIR_ERR_OS_TYPE, nam, 0);
if (res != 0)
goto error;
} else if (bootloader == 0) {
virXMLError(VIR_ERR_NO_OS, nam, 0);
goto error; goto error;
} }
xmlXPathFreeObject(obj);
if ((tmpobj == NULL) || !xmlStrEqual(tmpobj->stringval, BAD_CAST "hvm")) {
res = virDomainParseXMLOSDescPV(obj->nodesetval->nodeTab[0], &buf, ctxt, xendConfigVersion);
} else {
hvm = 1;
res = virDomainParseXMLOSDescHVM(obj->nodesetval->nodeTab[0], &buf, ctxt, xendConfigVersion);
}
xmlXPathFreeObject(tmpobj);
if (res != 0)
goto error;
} else if (bootloader == 0) {
virXMLError(VIR_ERR_NO_OS, nam, 0);
goto error;
} }
xmlXPathFreeObject(obj);
/* analyze of the devices */ /* analyze of the devices */
obj = xmlXPathEval(BAD_CAST "/domain/devices/disk", ctxt); obj = xmlXPathEval(BAD_CAST "/domain/devices/disk", ctxt);