qemu: Move CCW S390 Address check to controller def validate

Move the call to qemuDomainCheckCCWS390AddressSupport from
qemuBuildControllerDevStr to qemuDomainDeviceDefValidateController.

This means we will get the qemuCaps from the driver opaque
variable passed to qemuDomainDeviceDefValidate.
This commit is contained in:
John Ferlan 2017-11-29 10:49:37 -05:00
parent 3ba921869a
commit 29d8c17b98
2 changed files with 17 additions and 7 deletions

View File

@ -2662,10 +2662,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
*devstr = NULL;
if (!qemuDomainCheckCCWS390AddressSupport(domainDef, def->info, qemuCaps,
"controller"))
return -1;
if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
if ((qemuDomainSetSCSIControllerModel(domainDef, qemuCaps, &model)) < 0)
return -1;

View File

@ -3893,8 +3893,14 @@ qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk)
static int
qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller)
qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
if (!qemuDomainCheckCCWS390AddressSupport(def, controller->info, qemuCaps,
"controller"))
return -1;
switch ((virDomainControllerType) controller->type) {
case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
@ -3915,9 +3921,15 @@ qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller)
static int
qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
const virDomainDef *def,
void *opaque ATTRIBUTE_UNUSED)
void *opaque)
{
int ret = 0;
virQEMUDriverPtr driver = opaque;
virQEMUCapsPtr qemuCaps = NULL;
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
def->emulator)))
return -1;
switch ((virDomainDeviceType) dev->type) {
case VIR_DOMAIN_DEVICE_NET:
@ -3957,7 +3969,8 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
break;
case VIR_DOMAIN_DEVICE_CONTROLLER:
ret = qemuDomainDeviceDefValidateController(dev->data.controller);
ret = qemuDomainDeviceDefValidateController(dev->data.controller, def,
qemuCaps);
break;
case VIR_DOMAIN_DEVICE_LEASE:
@ -3978,6 +3991,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
break;
}
virObjectUnref(qemuCaps);
return ret;
}