goto error;
break;
+ case VIR_DOMAIN_DISK_BUS_FDC:
+ virBufferAsprintf(&opt, "floppy,unit=%d", disk->info.addr.drive.unit);
+ break;
+
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported disk bus '%s' with device setup"), bus);
else
driveLetter = 'A';
- if (qemuDomainDiskGetBackendAlias(disk, qemuCaps, &backendAlias) < 0)
- goto cleanup;
-
- if (backendAlias &&
- virAsprintf(&backendStr, "drive%c=%s", driveLetter, backendAlias) < 0)
- goto cleanup;
-
if (bootindex &&
virAsprintf(&bootindexStr, "bootindex%c=%u", driveLetter, bootindex) < 0)
goto cleanup;
+ /* with -blockdev we setup the floppy device and it's backend with -device */
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
+ if (qemuDomainDiskGetBackendAlias(disk, qemuCaps, &backendAlias) < 0)
+ goto cleanup;
+
+ if (backendAlias &&
+ virAsprintf(&backendStr, "drive%c=%s", driveLetter, backendAlias) < 0)
+ goto cleanup;
+ }
+
if (!explicitfdc) {
if (backendStr) {
virCommandAddArg(cmd, "-global");
return -1;
if (!qemuDiskBusNeedsDriveArg(disk->bus)) {
- if (disk->bus != VIR_DOMAIN_DISK_BUS_FDC) {
+ if (disk->bus != VIR_DOMAIN_DISK_BUS_FDC ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
virCommandAddArg(cmd, "-device");
if (!(optstr = qemuBuildDiskDeviceStr(def, disk, bootindex,
unsigned int bootCD = 0;
unsigned int bootFloppy = 0;
unsigned int bootDisk = 0;
+ bool blockdev = virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV);
for (i = 0; i < def->os.nBootDevs; i++) {
switch (def->os.bootDevs[i]) {
}
}
+ /* If we want to express the floppy drives via -device, the controller needs
+ * to be instantiated prior to that */
+ if (blockdev &&
+ qemuBuildFloppyCommandLineControllerOptions(cmd, def, qemuCaps, bootFloppy) < 0)
+ return -1;
+
for (i = 0; i < def->ndisks; i++) {
virDomainDiskDefPtr disk = def->disks[i];
unsigned int bootindex = 0;
}
}
- if (qemuBuildDiskCommandLine(cmd, def, disk, qemuCaps,
- bootindex) < 0)
+ /* The floppy device itself does not support the bootindex property
+ * so we need to set it up for the controller */
+ if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
+ bootindex = 0;
+
+ if (qemuBuildDiskCommandLine(cmd, def, disk, qemuCaps, bootindex) < 0)
return -1;
}
- if (qemuBuildFloppyCommandLineControllerOptions(cmd, def, qemuCaps, bootFloppy) < 0)
+ if (!blockdev &&
+ qemuBuildFloppyCommandLineControllerOptions(cmd, def, qemuCaps, bootFloppy) < 0)
return -1;
return 0;