Now that the controller model is updated during post parse callback,
this code no longer needs to fetch the model based on the capabilities
and can just return the model directly if the controller is found.
Removal of @qemuCaps cascades through various callers which are now
updated to not pass the capabilities.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_alias.c | 8 +++-----
src/qemu/qemu_alias.h | 3 +--
src/qemu/qemu_command.c | 11 ++++-------
src/qemu/qemu_command.h | 3 +--
src/qemu/qemu_domain_address.c | 6 ++----
src/qemu/qemu_domain_address.h | 3 +--
src/qemu/qemu_hotplug.c | 6 +++---
7 files changed, 15 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index ed3af04de..e8c1256b7 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -179,8 +179,7 @@ qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef,
/* Our custom -drive naming scheme used with id= */
int
qemuAssignDeviceDiskAlias(virDomainDefPtr def,
- virDomainDiskDefPtr disk,
- virQEMUCapsPtr qemuCaps)
+ virDomainDiskDefPtr disk)
{
const char *prefix = virDomainDiskBusTypeToString(disk->bus);
int controllerModel = -1;
@@ -191,8 +190,7 @@ qemuAssignDeviceDiskAlias(virDomainDefPtr def,
if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
controllerModel = qemuDomainFindSCSIControllerModel(def,
- &disk->info,
- qemuCaps);
+ &disk->info);
if (controllerModel < 0)
return -1;
}
@@ -539,7 +537,7 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
size_t i;
for (i = 0; i < def->ndisks; i++) {
- if (qemuAssignDeviceDiskAlias(def, def->disks[i], qemuCaps) < 0)
+ if (qemuAssignDeviceDiskAlias(def, def->disks[i]) < 0)
return -1;
}
for (i = 0; i < def->nnets; i++) {
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
index 11bbc2860..2246e712f 100644
--- a/src/qemu/qemu_alias.h
+++ b/src/qemu/qemu_alias.h
@@ -39,8 +39,7 @@ int qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef,
virDomainControllerDefPtr controller);
int qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef,
- virDomainDiskDefPtr def,
- virQEMUCapsPtr qemuCaps);
+ virDomainDiskDefPtr def);
int qemuAssignDeviceHostdevAlias(virDomainDefPtr def,
char **alias,
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f82a78155..899f0cbbb 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2042,8 +2042,7 @@ qemuBuildDriveDevStr(const virDomainDef *def,
goto error;
}
- controllerModel = qemuDomainFindSCSIControllerModel(def, &disk->info,
- qemuCaps);
+ controllerModel = qemuDomainFindSCSIControllerModel(def, &disk->info);
if (controllerModel < 0)
goto error;
@@ -5132,15 +5131,14 @@ qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
char *
qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
- virDomainHostdevDefPtr dev,
- virQEMUCapsPtr qemuCaps)
+ virDomainHostdevDefPtr dev)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
int model = -1;
char *driveAlias;
const char *contAlias;
- model = qemuDomainFindSCSIControllerModel(def, dev->info, qemuCaps);
+ model = qemuDomainFindSCSIControllerModel(def, dev->info);
if (model < 0)
goto error;
@@ -5623,8 +5621,7 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
VIR_FREE(drvstr);
virCommandAddArg(cmd, "-device");
- if (!(devstr = qemuBuildSCSIHostdevDevStr(def, hostdev,
- qemuCaps)))
+ if (!(devstr = qemuBuildSCSIHostdevDevStr(def, hostdev)))
return -1;
virCommandAddArg(cmd, devstr);
VIR_FREE(devstr);
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index bdde6f918..31c9da673 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -154,8 +154,7 @@ char *qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps);
char *qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
- virDomainHostdevDefPtr dev,
- virQEMUCapsPtr qemuCaps);
+ virDomainHostdevDefPtr dev);
char *
qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
virDomainHostdevDefPtr dev,
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index aa736131e..6272b1e91 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -102,7 +102,6 @@ qemuDomainSetSCSIControllerModel(const virDomainDef *def,
/**
* @def: Domain definition
* @info: Domain device info
- * @qemuCaps: QEMU capabilities
*
* Using the device info, find the controller related to the
* device by index and use that controller to return the model.
@@ -111,8 +110,7 @@ qemuDomainSetSCSIControllerModel(const virDomainDef *def,
*/
int
qemuDomainFindSCSIControllerModel(const virDomainDef *def,
- virDomainDeviceInfoPtr info,
- virQEMUCapsPtr qemuCaps)
+ virDomainDeviceInfoPtr info)
{
virDomainControllerDefPtr cont;
@@ -123,7 +121,7 @@ qemuDomainFindSCSIControllerModel(const virDomainDef *def,
return -1;
}
- return qemuDomainGetSCSIControllerModel(def, cont, qemuCaps);
+ return cont->model;
}
diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h
index 04fb2fc14..83f8e81ca 100644
--- a/src/qemu/qemu_domain_address.h
+++ b/src/qemu/qemu_domain_address.h
@@ -37,8 +37,7 @@ int qemuDomainSetSCSIControllerModel(const virDomainDef *def,
virQEMUCapsPtr qemuCaps);
int qemuDomainFindSCSIControllerModel(const virDomainDef *def,
- virDomainDeviceInfoPtr info,
- virQEMUCapsPtr qemuCaps);
+ virDomainDeviceInfoPtr info);
int qemuDomainAssignAddresses(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index fccbc29a0..2aa927e62 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -381,7 +381,7 @@ qemuDomainAttachDiskGeneric(virConnectPtr conn,
if (qemuHotplugPrepareDiskAccess(driver, vm, disk, NULL, false) < 0)
goto cleanup;
- if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
+ if (qemuAssignDeviceDiskAlias(vm->def, disk) < 0)
goto error;
if (qemuDomainPrepareDiskSource(conn, disk, priv, cfg) < 0)
@@ -2405,7 +2405,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
if (!(drivealias = qemuAliasFromHostdev(hostdev)))
goto cleanup;
- if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev, priv->qemuCaps)))
+ if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev)))
goto cleanup;
if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
@@ -4634,7 +4634,7 @@ qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
}
if (!detach->info.alias) {
- if (qemuAssignDeviceDiskAlias(vm->def, detach, priv->qemuCaps) < 0)
+ if (qemuAssignDeviceDiskAlias(vm->def, detach) < 0)
goto cleanup;
}
--
2.13.6