mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 19:02:25 +00:00
virDomainInputDefValidate: Validate model
If input device has one of virtio* models set then it has to go onto virtio bus. Introduce such check into the validator. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2081981 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
bded22e3a7
commit
b4161c2d42
@ -2306,6 +2306,27 @@ virDomainInputDefValidate(const virDomainInputDef *input,
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch ((virDomainInputModel)input->model) {
|
||||
case VIR_DOMAIN_INPUT_MODEL_VIRTIO:
|
||||
case VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL:
|
||||
case VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL:
|
||||
if (input->bus != VIR_DOMAIN_INPUT_BUS_VIRTIO) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("only bus 'virtio' is supported for input model '%s'"),
|
||||
virDomainInputModelTypeToString(input->model));
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_INPUT_MODEL_DEFAULT:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_INPUT_MODEL_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virDomainInputModel, input->model);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user