mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 06:35:24 +00:00
qemu: Update qemuDomainFindSCSIControllerModel return
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.
This commit is contained in:
parent
de8fac5f21
commit
5b5bff35a8
@ -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++) {
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user