提交 9cddc6e8 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 8e09cf1d
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册