[PATCH 2/2] Avoid starting a PowerPC VM with floppy disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PowerPC pseries based VMs do not support a floppy disk controller.
This prohibits libvirt from creating qemu command with floppy device.

Signed-off-by: Kothapally Madhu Pavan <kmp@xxxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_command.c |   47 +++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 42906a8..93f84e2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9486,6 +9486,12 @@ qemuBuildCommandLine(virConnectPtr conn,
                 boot[i] = 'd';
                 break;
             case VIR_DOMAIN_BOOT_FLOPPY:
+                /* PowerPC pseries based VMs do not support floppy device */
+                if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) {
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                   _("PowerPC pseries machines do not support floppy device"));
+                    goto error;
+                }
                 boot[i] = 'a';
                 break;
             case VIR_DOMAIN_BOOT_DISK:
@@ -9769,6 +9775,12 @@ qemuBuildCommandLine(virConnectPtr conn,
                 bootCD = 0;
                 break;
             case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
+                /* PowerPC pseries based VMs do not support floppy device */
+                if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) {
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                   _("PowerPC pseries machines do not support floppy device"));
+                    goto error;
+                }
                 bootindex = bootFloppy;
                 bootFloppy = 0;
                 break;
@@ -9812,6 +9824,12 @@ qemuBuildCommandLine(virConnectPtr conn,
 
             if (withDeviceArg) {
                 if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) {
+                    /* PowerPC pseries based VMs do not support floppy device */
+                    if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) {
+                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                       _("PowerPC pseries machines do not support floppy device"));
+                            goto error;
+                    }
                     if (virAsprintf(&optstr, "drive%c=drive-%s",
                                     disk->info.addr.drive.unit ? 'B' : 'A',
                                     disk->info.alias) < 0)
@@ -9854,6 +9872,12 @@ qemuBuildCommandLine(virConnectPtr conn,
         /* Newer Q35 machine types require an explicit FDC controller */
         virBufferTrim(&fdc_opts, ",", -1);
         if ((fdc_opts_str = virBufferContentAndReset(&fdc_opts))) {
+            /* PowerPC pseries based VMs do not support floppy device */
+            if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("PowerPC pseries machines do not support floppy device"));
+                goto error;
+            }
             virCommandAddArg(cmd, "-device");
             virCommandAddArgFormat(cmd, "isa-fdc,%s", fdc_opts_str);
             VIR_FREE(fdc_opts_str);
@@ -9918,10 +9942,17 @@ qemuBuildCommandLine(virConnectPtr conn,
                                    _("cannot create virtual FAT disks in read-write mode"));
                     goto error;
                 }
-                if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
+                if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
+                    /* PowerPC pseries based VMs do not support floppy device */
+                    if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) {
+                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                       _("PowerPC pseries machines do not support floppy device"));
+                        goto error;
+                    }
                     fmt = "fat:floppy:%s";
-                else
+                } else {
                     fmt = "fat:%s";
+                }
 
                 if (virAsprintf(&file, fmt, disk->src) < 0)
                     goto error;
@@ -11674,6 +11705,12 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
                 def->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
                 def->src->readonly = true;
             } else if (STREQ(values[i], "floppy")) {
+                /* PowerPC pseries based VMs do not support floppy device */
+                if (ARCH_IS_PPC64(dom->os.arch) && STRPREFIX(dom->os.machine, "pseries")) {
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                   _("PowerPC pseries machines do not support floppy device"));
+                    goto error;
+                }
                 def->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
             }
         } else if (STREQ(keywords[i], "format")) {
@@ -12908,6 +12945,12 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
                 disk->src->readonly = true;
             } else {
                 if (STRPREFIX(arg, "-fd")) {
+                    /* PowerPC pseries based VMs do not support floppy device */
+                    if (ARCH_IS_PPC64(def->os.arch) && STRPREFIX(def->os.machine, "pseries")) {
+                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                       _("PowerPC pseries machines do not support floppy device"));
+                        goto error;
+                    }
                     disk->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
                     disk->bus = VIR_DOMAIN_DISK_BUS_FDC;
                 } else {

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]