From e4e7c3ae54d780a2fa6ec025b886ec3cee1b3a44 Mon Sep 17 00:00:00 2001 From: fupan Date: Wed, 19 Dec 2018 11:46:48 +0800 Subject: [PATCH] katautils: check config template and vsock Vsock conflicts with factory, when both of them are enabled, kata will try to create a new vm template which is useless, thus it's better to return an error directly to let users know that those two config cannot be enabled at the same time. Fixes: #1055 Signed-off-by: fupan --- pkg/katautils/config.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/katautils/config.go b/pkg/katautils/config.go index ffc5feda8b..f4285aee86 100644 --- a/pkg/katautils/config.go +++ b/pkg/katautils/config.go @@ -737,8 +737,14 @@ func checkNetNsConfig(config oci.RuntimeConfig) error { // checkFactoryConfig ensures the VM factory configuration is valid. func checkFactoryConfig(config oci.RuntimeConfig) error { - if config.FactoryConfig.Template && config.HypervisorConfig.InitrdPath == "" { - return errors.New("Factory option enable_template requires an initrd image") + if config.FactoryConfig.Template { + if config.HypervisorConfig.InitrdPath == "" { + return errors.New("Factory option enable_template requires an initrd image") + } + + if config.HypervisorConfig.UseVSock { + return errors.New("config vsock conflicts with factory, please disable one of them") + } } return nil