Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
katautils: check config template and vsock
Browse files Browse the repository at this point in the history
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 <lifupan@gmail.com>
  • Loading branch information
lifupan committed Dec 19, 2018
1 parent bcf995b commit e4e7c3a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/katautils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e4e7c3a

Please # to comment.