mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
domain_conf: Make virDomainDeviceFindSCSIController accept virDomainDeviceDriveAddress struct
So far, the virDomainDeviceFindSCSIController() takes virDomainDeviceInfo structure which is an overkill. It assumes that the passed structure is type of VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE which is not obvious. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
8e09cf1d5a
commit
9cddc6e8ee
@ -8528,13 +8528,13 @@ virDomainHostdevDefParseXMLCaps(xmlNodePtr node G_GNUC_UNUSED,
|
||||
|
||||
virDomainControllerDefPtr
|
||||
virDomainDeviceFindSCSIController(const virDomainDef *def,
|
||||
virDomainDeviceInfoPtr info)
|
||||
const virDomainDeviceDriveAddress *addr)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < def->ncontrollers; i++) {
|
||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
|
||||
def->controllers[i]->idx == info->addr.drive.controller)
|
||||
def->controllers[i]->idx == addr->controller)
|
||||
return def->controllers[i];
|
||||
}
|
||||
|
||||
@ -18560,7 +18560,7 @@ virDomainDefMaybeAddHostdevSCSIcontroller(virDomainDefPtr def)
|
||||
* So let's grab the model from it and update the model we're
|
||||
* going to add as long as this one isn't undefined. The premise
|
||||
* being keeping the same controller model for all SCSI hostdevs. */
|
||||
cont = virDomainDeviceFindSCSIController(def, hostdev->info);
|
||||
cont = virDomainDeviceFindSCSIController(def, &hostdev->info->addr.drive);
|
||||
if (cont && cont->model != -1)
|
||||
newModel = cont->model;
|
||||
}
|
||||
|
@ -2858,7 +2858,10 @@ int virDomainDiskGetFormat(virDomainDiskDefPtr def);
|
||||
void virDomainDiskSetFormat(virDomainDiskDefPtr def, int format);
|
||||
virDomainControllerDefPtr
|
||||
virDomainDeviceFindSCSIController(const virDomainDef *def,
|
||||
virDomainDeviceInfoPtr info);
|
||||
const virDomainDeviceDriveAddress *addr);
|
||||
virDomainDiskDefPtr virDomainDiskFindByBusAndDst(virDomainDefPtr def,
|
||||
int bus,
|
||||
char *dst);
|
||||
|
||||
virDomainControllerDefPtr virDomainControllerDefNew(virDomainControllerType type);
|
||||
void virDomainControllerDefFree(virDomainControllerDefPtr def);
|
||||
|
@ -111,7 +111,7 @@ qemuDomainFindSCSIControllerModel(const virDomainDef *def,
|
||||
{
|
||||
virDomainControllerDefPtr cont;
|
||||
|
||||
if (!(cont = virDomainDeviceFindSCSIController(def, info))) {
|
||||
if (!(cont = virDomainDeviceFindSCSIController(def, &info->addr.drive))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unable to find a SCSI controller for idx=%d"),
|
||||
info->addr.drive.controller);
|
||||
|
@ -1110,7 +1110,7 @@ vboxAttachDrives(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
|
||||
case VIR_DOMAIN_DISK_BUS_SCSI:
|
||||
VBOX_UTF8_TO_UTF16(VBOX_CONTROLLER_SCSI_NAME, &storageCtlName);
|
||||
|
||||
cont = virDomainDeviceFindSCSIController(def, &disk->info);
|
||||
cont = virDomainDeviceFindSCSIController(def, &disk->info.addr.drive);
|
||||
if (cont && cont->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068) {
|
||||
VBOX_UTF16_FREE(storageCtlName);
|
||||
VBOX_UTF8_TO_UTF16(VBOX_CONTROLLER_SAS_NAME, &storageCtlName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user