qemu: command: Rename and export qemuDiskBusNeedsDeviceArg

Change the semantics to exactly opposite and rename it to
qemuDiskBusNeedsDriveArg. This will be necessary as some devices can't
be used with -blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-06-07 12:01:24 +02:00
parent d60c17b3d7
commit aa624c3bfb
2 changed files with 14 additions and 10 deletions

View File

@ -1330,15 +1330,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)
/**
* qemuDiskBusNeedsDriveArg:
* @bus: disk bus
*
* Unfortunately it is not possible to use -device for SD devices.
* Fortunately, those don't need static PCI addresses, so we can use -drive
* without -device.
*/
bool
qemuDiskBusNeedsDriveArg(int bus)
{
return bus != VIR_DOMAIN_DISK_BUS_SD;
return bus == VIR_DOMAIN_DISK_BUS_SD;
}
@ -1636,7 +1639,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
if (qemuBuildDriveSourceStr(disk, qemuCaps, &opt) < 0)
goto error;
if (qemuDiskBusNeedsDeviceArg(disk->bus)) {
if (!qemuDiskBusNeedsDriveArg(disk->bus)) {
char *drivealias = qemuAliasDiskDriveFromDisk(disk);
if (!drivealias)
goto error;
@ -2250,7 +2253,7 @@ qemuBuildDiskCommandLine(virCommandPtr cmd,
qemuBlockStorageSourceAttachDataFree(data);
if (qemuDiskBusNeedsDeviceArg(disk->bus)) {
if (!qemuDiskBusNeedsDriveArg(disk->bus)) {
if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) {
if (qemuBuildFloppyCommandLineOptions(cmd, def, disk,
bootindex) < 0)

View File

@ -99,6 +99,7 @@ char *qemuBuildNicDevStr(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps);
char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk);
bool qemuDiskBusNeedsDriveArg(int bus);
qemuBlockStorageSourceAttachDataPtr
qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk,