mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 16:15:19 +00:00
qemu: Introduce qemuDomainDeviceDefValidateControllerIDE
Move the IDE controller check from command line building to controller def validation. Also explicitly include the avoidance check for the implicit IDE controller from qemuBuildSkipController. Cause the IDE case for command line building to generate a failure if called to add an IDE since that shouldn't happen if the Validate code did the right thing.
This commit is contained in:
parent
29d8c17b98
commit
07adbd4b1f
src/qemu
@ -3120,22 +3120,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
|
||||
/* Since we currently only support the integrated IDE
|
||||
* controller on various boards, if we ever get to here, it's
|
||||
* because some other machinetype had an IDE controller
|
||||
* specified, or one with a single IDE contraller had multiple
|
||||
* ide controllers specified.
|
||||
*/
|
||||
if (qemuDomainHasBuiltinIDE(domainDef))
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Only a single IDE controller is supported "
|
||||
"for this machine type"));
|
||||
else
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("IDE controllers are unsupported for "
|
||||
"this QEMU binary or machine type"));
|
||||
goto error;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
|
||||
case VIR_DOMAIN_CONTROLLER_TYPE_LAST:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
|
@ -3892,17 +3892,48 @@ qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDeviceDefValidateControllerIDE(const virDomainControllerDef *controller,
|
||||
const virDomainDef *def)
|
||||
{
|
||||
/* first IDE controller is implicit on various machines */
|
||||
if (controller->idx == 0 && qemuDomainHasBuiltinIDE(def))
|
||||
return 0;
|
||||
|
||||
/* Since we currently only support the integrated IDE
|
||||
* controller on various boards, if we ever get to here, it's
|
||||
* because some other machinetype had an IDE controller
|
||||
* specified, or one with a single IDE controller had multiple
|
||||
* IDE controllers specified.
|
||||
*/
|
||||
if (qemuDomainHasBuiltinIDE(def))
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Only a single IDE controller is supported "
|
||||
"for this machine type"));
|
||||
else
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("IDE controllers are unsupported for "
|
||||
"this QEMU binary or machine type"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller,
|
||||
const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!qemuDomainCheckCCWS390AddressSupport(def, controller->info, qemuCaps,
|
||||
"controller"))
|
||||
return -1;
|
||||
|
||||
switch ((virDomainControllerType) controller->type) {
|
||||
case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
|
||||
ret = qemuDomainDeviceDefValidateControllerIDE(controller, def);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
|
||||
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
|
||||
case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
|
||||
@ -3914,7 +3945,7 @@ qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller,
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user