PowerPC pseries based VMs do not support a floppy disk controller.
This prohibits libvirt from adding floppy disk for a PowerPC pseries VM.
Signed-off-by: Kothapally Madhu Pavan <kmp(a)linux.vnet.ibm.com>
---
src/conf/domain_conf.c | 19 +++++++++++++++----
src/qemu/qemu_capabilities.c | 15 +++++++++++----
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 73ac537..b9f35b4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6540,7 +6540,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
virHashTablePtr bootHash,
virSecurityLabelDefPtr* vmSeclabels,
int nvmSeclabels,
- unsigned int flags)
+ unsigned int flags,
+ virArch arch,
+ const char *machine)
{
virDomainDiskDefPtr def;
xmlNodePtr sourceNode = NULL;
@@ -7165,6 +7167,12 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
}
} else {
if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
+ /* PowerPC pseries based VMs do not support floppy device */
+ if (ARCH_IS_PPC64(arch) && STRPREFIX(machine, "pseries"))
{
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("PowerPC pseries machines do not support floppy
device"));
+ goto error;
+ }
def->bus = VIR_DOMAIN_DISK_BUS_FDC;
} else if (!(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
if (STRPREFIX(target, "hd"))
@@ -12375,7 +12383,8 @@ virDomainDeviceDefParse(const char *xmlStr,
if (!(dev->data.disk = virDomainDiskDefParseXML(xmlopt, node, ctxt,
NULL, def->seclabels,
def->nseclabels,
- flags)))
+ flags, def->os.arch,
+ def->os.machine)))
goto error;
break;
case VIR_DOMAIN_DEVICE_LEASE:
@@ -12519,7 +12528,8 @@ virDomainDiskDefSourceParse(const char *xmlStr,
if (!(disk = virDomainDiskDefParseXML(xmlopt, node, ctxt,
NULL, def->seclabels,
def->nseclabels,
- flags)))
+ flags, def->os.arch,
+ def->os.machine)))
goto cleanup;
ret = disk->src;
@@ -15539,7 +15549,8 @@ virDomainDefParseXML(xmlDocPtr xml,
bootHash,
def->seclabels,
def->nseclabels,
- flags);
+ flags, def->os.arch,
+ def->os.machine);
if (!disk)
goto error;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d8cb32d..e304473 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3919,25 +3919,32 @@ virQEMUCapsFillDomainOSCaps(virQEMUCapsPtr qemuCaps,
static int
virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps,
+ const char *machine,
virDomainCapsDeviceDiskPtr disk)
{
disk->device.supported = true;
/* QEMU supports all of these */
VIR_DOMAIN_CAPS_ENUM_SET(disk->diskDevice,
VIR_DOMAIN_DISK_DEVICE_DISK,
- VIR_DOMAIN_DISK_DEVICE_CDROM,
- VIR_DOMAIN_DISK_DEVICE_FLOPPY);
+ VIR_DOMAIN_DISK_DEVICE_CDROM);
+
+ /* PowerPC pseries based VMs do not support floppy device */
+ if (!(ARCH_IS_PPC64(qemuCaps->arch) && STRPREFIX(machine,
"pseries")))
+ VIR_DOMAIN_CAPS_ENUM_SET(disk->diskDevice, VIR_DOMAIN_DISK_DEVICE_FLOPPY);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO))
VIR_DOMAIN_CAPS_ENUM_SET(disk->diskDevice, VIR_DOMAIN_DISK_DEVICE_LUN);
VIR_DOMAIN_CAPS_ENUM_SET(disk->bus,
VIR_DOMAIN_DISK_BUS_IDE,
- VIR_DOMAIN_DISK_BUS_FDC,
VIR_DOMAIN_DISK_BUS_SCSI,
VIR_DOMAIN_DISK_BUS_VIRTIO,
/* VIR_DOMAIN_DISK_BUS_SD */);
+ /* PowerPC pseries based VMs do not support floppy device */
+ if (!(ARCH_IS_PPC64(qemuCaps->arch) && STRPREFIX(machine,
"pseries")))
+ VIR_DOMAIN_CAPS_ENUM_SET(disk->bus, VIR_DOMAIN_DISK_BUS_FDC);
+
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE))
VIR_DOMAIN_CAPS_ENUM_SET(disk->bus, VIR_DOMAIN_DISK_BUS_USB);
return 0;
@@ -4008,7 +4015,7 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
if (virQEMUCapsFillDomainOSCaps(qemuCaps, os,
loader, nloader) < 0 ||
- virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, disk) < 0 ||
+ virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, domCaps->machine, disk) < 0
||
virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0)
return -1;
return 0;