51 lines
1.7 KiB
Diff
51 lines
1.7 KiB
Diff
From 5d17ae66252024451c1e9f30f348f5e223b26c72 Mon Sep 17 00:00:00 2001
|
|
From: chenyuhui <chenyuhui5@huawei.com>
|
|
Date: Tue, 2 Aug 2022 10:51:59 +0800
|
|
Subject: [PATCH 19/22] 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>
|
|
---
|
|
src/conf/domain_conf.c | 21 +++++++++++++++++++++
|
|
1 file changed, 21 insertions(+)
|
|
|
|
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
index 2d1726af8f..b8cf1adb98 100644
|
|
--- a/src/conf/domain_conf.c
|
|
+++ b/src/conf/domain_conf.c
|
|
@@ -6834,6 +6834,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.33.0
|
|
|