Ensure we strip the :disk postfix from disks in Xen 3.0.3

This commit is contained in:
Daniel P. Berrange
2006-09-14 15:34:50 +00:00
parent 1ed4d29208
commit 4e7b9aa2e1
9 changed files with 53 additions and 20 deletions

View File

@@ -1566,12 +1566,18 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
}
if (!strncmp(dst, "ioemu:", 6))
dst += 6;
/* New style cdrom config from Xen >= 3.0.3 */
/* New style disk config from Xen >= 3.0.3 */
if (xendConfigVersion > 1) {
char *offset = rindex(dst, ':');
if (offset && !strcmp(offset, ":cdrom")) {
offset[0] = '\0';
cdrom = 1;
if (offset) {
if (!strcmp(offset, ":cdrom")) {
cdrom = 1;
} else if (!strcmp(offset, ":disk")) {
/* defualt anyway */
} else {
/* Unknown, lets pretend its a disk */
}
offset[0] = '\0';
}
}
@@ -1599,9 +1605,15 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
/* New style cdrom config from Xen >= 3.0.3 */
if (xendConfigVersion > 1) {
char *offset = rindex(dst, ':');
if (offset && !strcmp(offset, ":cdrom")) {
offset[0] = '\0';
cdrom = 1;
if (offset) {
if (!strcmp(offset, ":cdrom")) {
cdrom = 1;
} else if (!strcmp(offset, ":disk")) {
/* defualt anyway */
} else {
/* Unknown, lets pretend its a disk */
}
offset[0] = '\0';
}
}
@@ -2850,3 +2862,11 @@ xenDaemonCreateLinux(virConnectPtr conn, const char *xmlDesc,
}
#endif /* ! PROXY */
/*
* Local variables:
* indent-tabs-mode: nil
* c-indent-level: 4
* c-basic-offset: 4
* tab-width: 4
* End:
*/

View File

@@ -973,15 +973,15 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
* under the hvm (image (os)) block
*/
if (hvm &&
device &&
device &&
!strcmp((const char *)device, "floppy")) {
return 0;
}
/* Xend <= 3.0.2 doesn't include cdrom config here */
if (hvm &&
device &&
!strcmp((const char *)device, "cdrom")) {
device &&
!strcmp((const char *)device, "cdrom")) {
if (xendConfigVersion == 1)
return 0;
else
@@ -1002,7 +1002,7 @@ virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendCo
if (xendConfigVersion == 1)
virBufferVSprintf(buf, "(dev 'ioemu:%s')", (const char *) tmp);
else /* But newer does not */
virBufferVSprintf(buf, "(dev '%s%s')", (const char *) tmp, cdrom ? ":cdrom" : "");
virBufferVSprintf(buf, "(dev '%s%s')", (const char *) tmp, cdrom ? ":cdrom" : ":disk");
} else
virBufferVSprintf(buf, "(dev '%s')", (const char *) target);