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(a)redhat.com>
---
src/conf/domain_validate.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 1feb7a8f9c..f3910f08a4 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -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;
}
--
2.35.1