mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +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= */
|
/* Our custom -drive naming scheme used with id= */
|
||||||
int
|
int
|
||||||
qemuAssignDeviceDiskAlias(virDomainDefPtr def,
|
qemuAssignDeviceDiskAlias(virDomainDefPtr def,
|
||||||
virDomainDiskDefPtr disk,
|
virDomainDiskDefPtr disk)
|
||||||
virQEMUCapsPtr qemuCaps)
|
|
||||||
{
|
{
|
||||||
const char *prefix = virDomainDiskBusTypeToString(disk->bus);
|
const char *prefix = virDomainDiskBusTypeToString(disk->bus);
|
||||||
int controllerModel = -1;
|
int controllerModel = -1;
|
||||||
@ -191,8 +190,7 @@ qemuAssignDeviceDiskAlias(virDomainDefPtr def,
|
|||||||
if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
|
if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
|
||||||
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
|
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
|
||||||
controllerModel = qemuDomainFindSCSIControllerModel(def,
|
controllerModel = qemuDomainFindSCSIControllerModel(def,
|
||||||
&disk->info,
|
&disk->info);
|
||||||
qemuCaps);
|
|
||||||
if (controllerModel < 0)
|
if (controllerModel < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -539,7 +537,7 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < def->ndisks; 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;
|
return -1;
|
||||||
}
|
}
|
||||||
for (i = 0; i < def->nnets; i++) {
|
for (i = 0; i < def->nnets; i++) {
|
||||||
|
@ -39,8 +39,7 @@ int qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef,
|
|||||||
virDomainControllerDefPtr controller);
|
virDomainControllerDefPtr controller);
|
||||||
|
|
||||||
int qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef,
|
int qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef,
|
||||||
virDomainDiskDefPtr def,
|
virDomainDiskDefPtr def);
|
||||||
virQEMUCapsPtr qemuCaps);
|
|
||||||
|
|
||||||
int qemuAssignDeviceHostdevAlias(virDomainDefPtr def,
|
int qemuAssignDeviceHostdevAlias(virDomainDefPtr def,
|
||||||
char **alias,
|
char **alias,
|
||||||
|
@ -2042,8 +2042,7 @@ qemuBuildDriveDevStr(const virDomainDef *def,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
controllerModel = qemuDomainFindSCSIControllerModel(def, &disk->info,
|
controllerModel = qemuDomainFindSCSIControllerModel(def, &disk->info);
|
||||||
qemuCaps);
|
|
||||||
if (controllerModel < 0)
|
if (controllerModel < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -5132,15 +5131,14 @@ qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
|
|||||||
|
|
||||||
char *
|
char *
|
||||||
qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
|
qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
|
||||||
virDomainHostdevDefPtr dev,
|
virDomainHostdevDefPtr dev)
|
||||||
virQEMUCapsPtr qemuCaps)
|
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
int model = -1;
|
int model = -1;
|
||||||
char *driveAlias;
|
char *driveAlias;
|
||||||
const char *contAlias;
|
const char *contAlias;
|
||||||
|
|
||||||
model = qemuDomainFindSCSIControllerModel(def, dev->info, qemuCaps);
|
model = qemuDomainFindSCSIControllerModel(def, dev->info);
|
||||||
if (model < 0)
|
if (model < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -5623,8 +5621,7 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
|
|||||||
VIR_FREE(drvstr);
|
VIR_FREE(drvstr);
|
||||||
|
|
||||||
virCommandAddArg(cmd, "-device");
|
virCommandAddArg(cmd, "-device");
|
||||||
if (!(devstr = qemuBuildSCSIHostdevDevStr(def, hostdev,
|
if (!(devstr = qemuBuildSCSIHostdevDevStr(def, hostdev)))
|
||||||
qemuCaps)))
|
|
||||||
return -1;
|
return -1;
|
||||||
virCommandAddArg(cmd, devstr);
|
virCommandAddArg(cmd, devstr);
|
||||||
VIR_FREE(devstr);
|
VIR_FREE(devstr);
|
||||||
|
@ -154,8 +154,7 @@ char *qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
|
|||||||
virQEMUCapsPtr qemuCaps);
|
virQEMUCapsPtr qemuCaps);
|
||||||
|
|
||||||
char *qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
|
char *qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
|
||||||
virDomainHostdevDefPtr dev,
|
virDomainHostdevDefPtr dev);
|
||||||
virQEMUCapsPtr qemuCaps);
|
|
||||||
char *
|
char *
|
||||||
qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
|
qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
|
||||||
virDomainHostdevDefPtr dev,
|
virDomainHostdevDefPtr dev,
|
||||||
|
@ -102,7 +102,6 @@ qemuDomainSetSCSIControllerModel(const virDomainDef *def,
|
|||||||
/**
|
/**
|
||||||
* @def: Domain definition
|
* @def: Domain definition
|
||||||
* @info: Domain device info
|
* @info: Domain device info
|
||||||
* @qemuCaps: QEMU capabilities
|
|
||||||
*
|
*
|
||||||
* Using the device info, find the controller related to the
|
* Using the device info, find the controller related to the
|
||||||
* device by index and use that controller to return the model.
|
* device by index and use that controller to return the model.
|
||||||
@ -111,8 +110,7 @@ qemuDomainSetSCSIControllerModel(const virDomainDef *def,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
qemuDomainFindSCSIControllerModel(const virDomainDef *def,
|
qemuDomainFindSCSIControllerModel(const virDomainDef *def,
|
||||||
virDomainDeviceInfoPtr info,
|
virDomainDeviceInfoPtr info)
|
||||||
virQEMUCapsPtr qemuCaps)
|
|
||||||
{
|
{
|
||||||
virDomainControllerDefPtr cont;
|
virDomainControllerDefPtr cont;
|
||||||
|
|
||||||
@ -123,7 +121,7 @@ qemuDomainFindSCSIControllerModel(const virDomainDef *def,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return qemuDomainGetSCSIControllerModel(def, cont, qemuCaps);
|
return cont->model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,8 +37,7 @@ int qemuDomainSetSCSIControllerModel(const virDomainDef *def,
|
|||||||
virQEMUCapsPtr qemuCaps);
|
virQEMUCapsPtr qemuCaps);
|
||||||
|
|
||||||
int qemuDomainFindSCSIControllerModel(const virDomainDef *def,
|
int qemuDomainFindSCSIControllerModel(const virDomainDef *def,
|
||||||
virDomainDeviceInfoPtr info,
|
virDomainDeviceInfoPtr info);
|
||||||
virQEMUCapsPtr qemuCaps);
|
|
||||||
|
|
||||||
int qemuDomainAssignAddresses(virDomainDefPtr def,
|
int qemuDomainAssignAddresses(virDomainDefPtr def,
|
||||||
virQEMUCapsPtr qemuCaps,
|
virQEMUCapsPtr qemuCaps,
|
||||||
|
@ -381,7 +381,7 @@ qemuDomainAttachDiskGeneric(virConnectPtr conn,
|
|||||||
if (qemuHotplugPrepareDiskAccess(driver, vm, disk, NULL, false) < 0)
|
if (qemuHotplugPrepareDiskAccess(driver, vm, disk, NULL, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
|
if (qemuAssignDeviceDiskAlias(vm->def, disk) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (qemuDomainPrepareDiskSource(conn, disk, priv, cfg) < 0)
|
if (qemuDomainPrepareDiskSource(conn, disk, priv, cfg) < 0)
|
||||||
@ -2405,7 +2405,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
|
|||||||
if (!(drivealias = qemuAliasFromHostdev(hostdev)))
|
if (!(drivealias = qemuAliasFromHostdev(hostdev)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev, priv->qemuCaps)))
|
if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
|
if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
|
||||||
@ -4634,7 +4634,7 @@ qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!detach->info.alias) {
|
if (!detach->info.alias) {
|
||||||
if (qemuAssignDeviceDiskAlias(vm->def, detach, priv->qemuCaps) < 0)
|
if (qemuAssignDeviceDiskAlias(vm->def, detach) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user