1 Star 0 Fork 71

lIshaohui/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
virDomainInputDefValidate-Validate-model.patch 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
Jiangjiacheng 提交于 2023-01-04 12:02 . Backport patches from upstream
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/li-shaohui/libvirt.git
git@gitee.com:li-shaohui/libvirt.git
li-shaohui
libvirt
libvirt
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385