mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Introduce qemuDiskBusNeedsDeviceArg
Replace the two uses of the withDeviceArg bool in qemuBuildDiskDriveCommandLine and allow this function to be reused in qemuBuildDriveStr.
This commit is contained in:
parent
cd3b06b7f6
commit
2e33ef4822
@ -1080,6 +1080,18 @@ qemuCheckFips(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Unfortunately it is not possible to use
|
||||||
|
-device for floppies, or SD
|
||||||
|
devices. Fortunately, those don't need
|
||||||
|
static PCI addresses, so we don't really
|
||||||
|
care that we can't use -device */
|
||||||
|
static bool
|
||||||
|
qemuDiskBusNeedsDeviceArg(int bus)
|
||||||
|
{
|
||||||
|
return bus != VIR_DOMAIN_DISK_BUS_SD;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
||||||
bool bootable,
|
bool bootable,
|
||||||
@ -1904,7 +1916,6 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
|
|||||||
char *optstr;
|
char *optstr;
|
||||||
unsigned int bootindex = 0;
|
unsigned int bootindex = 0;
|
||||||
virDomainDiskDefPtr disk = def->disks[i];
|
virDomainDiskDefPtr disk = def->disks[i];
|
||||||
bool withDeviceArg = false;
|
|
||||||
bool deviceFlagMasked = false;
|
bool deviceFlagMasked = false;
|
||||||
|
|
||||||
/* PowerPC pseries based VMs do not support floppy device */
|
/* PowerPC pseries based VMs do not support floppy device */
|
||||||
@ -1934,14 +1945,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
|
|||||||
|
|
||||||
virCommandAddArg(cmd, "-drive");
|
virCommandAddArg(cmd, "-drive");
|
||||||
|
|
||||||
/* Unfortunately it is not possible to use
|
if (!qemuDiskBusNeedsDeviceArg(disk->bus)) {
|
||||||
-device for floppies, or SD
|
|
||||||
devices. Fortunately, those don't need
|
|
||||||
static PCI addresses, so we don't really
|
|
||||||
care that we can't use -device */
|
|
||||||
if (disk->bus != VIR_DOMAIN_DISK_BUS_SD) {
|
|
||||||
withDeviceArg = true;
|
|
||||||
} else {
|
|
||||||
virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
|
virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
|
||||||
deviceFlagMasked = true;
|
deviceFlagMasked = true;
|
||||||
}
|
}
|
||||||
@ -1960,7 +1964,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
|
|||||||
else if (disk->info.bootIndex)
|
else if (disk->info.bootIndex)
|
||||||
bootindex = disk->info.bootIndex;
|
bootindex = disk->info.bootIndex;
|
||||||
|
|
||||||
if (withDeviceArg) {
|
if (qemuDiskBusNeedsDeviceArg(disk->bus)) {
|
||||||
if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) {
|
if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) {
|
||||||
if (virAsprintf(&optstr, "drive%c=drive-%s",
|
if (virAsprintf(&optstr, "drive%c=drive-%s",
|
||||||
disk->info.addr.drive.unit ? 'B' : 'A',
|
disk->info.addr.drive.unit ? 'B' : 'A',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user