correctly enable floppies for HVM guests.

This commit is contained in:
John Levon 2009-01-29 17:05:49 +00:00
parent 3463c34e33
commit a10aa7a96b
2 changed files with 42 additions and 12 deletions

View File

@ -1,3 +1,9 @@
Thu Jan 29 09:03:17 PST 2009 John Levon <john.levon@sun.com>
* src/xend_internal.c: correctly enable floppies for HVM guests.
Refuse to directly attach disks that won't work via
device_create.
Thu Jan 29 16:41:07 GMT 2009 John Levon <john.levon@sun.com> Thu Jan 29 16:41:07 GMT 2009 John Levon <john.levon@sun.com>
* src/util.c: allow strtol replacements for libvirt proxy * src/util.c: allow strtol replacements for libvirt proxy

View File

@ -5020,14 +5020,26 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
* under the hvm (image (os)) block * under the hvm (image (os)) block
*/ */
if (hvm && if (hvm &&
def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
if (isAttach) {
virXendError(conn, VIR_ERR_INVALID_ARG,
_("Cannot directly attach floppy %s"), def->src);
return -1;
}
return 0; return 0;
}
/* Xend <= 3.0.2 doesn't include cdrom config here */ /* Xend <= 3.0.2 doesn't include cdrom config here */
if (hvm && if (hvm &&
def->device == VIR_DOMAIN_DISK_DEVICE_CDROM && def->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
xendConfigVersion == 1) xendConfigVersion == 1) {
if (isAttach) {
virXendError(conn, VIR_ERR_INVALID_ARG,
_("Cannot directly attach CDROM %s"), def->src);
return -1;
}
return 0; return 0;
}
if (!isAttach) if (!isAttach)
virBufferAddLit(buf, "(device "); virBufferAddLit(buf, "(device ");
@ -5376,17 +5388,29 @@ xenDaemonFormatSxpr(virConnectPtr conn,
} }
virBufferVSprintf(&buf, "(boot %s)", bootorder); virBufferVSprintf(&buf, "(boot %s)", bootorder);
/* get the cdrom device file */ /* some disk devices are defined here */
/* Only XenD <= 3.0.2 wants cdrom config here */ for (i = 0 ; i < def->ndisks ; i++) {
if (xendConfigVersion == 1) { switch (def->disks[i]->device) {
for (i = 0 ; i < def->ndisks ; i++) { case VIR_DOMAIN_DISK_DEVICE_CDROM:
if (def->disks[i]->type == VIR_DOMAIN_DISK_DEVICE_CDROM && /* Only xend <= 3.0.2 wants cdrom config here */
STREQ(def->disks[i]->dst, "hdc") && if (xendConfigVersion != 1)
def->disks[i]->src) {
virBufferVSprintf(&buf, "(cdrom '%s')",
def->disks[i]->src);
break; break;
} if (!STREQ(def->disks[i]->dst, "hdc") ||
def->disks[i]->src == NULL)
break;
virBufferVSprintf(&buf, "(cdrom '%s')",
def->disks[i]->src);
break;
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
/* all xend versions define floppies here */
virBufferVSprintf(&buf, "(%s '%s')", def->disks[i]->dst,
def->disks[i]->src);
break;
default:
break;
} }
} }