mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-28 12:31:04 +00:00
Merge pull request #1547 from teawater/vmtemplate_init_check
factory: Check if vm templateing is on before vm templateing initialize
This commit is contained in:
commit
3bdc40bfd0
@ -46,7 +46,12 @@ func New(ctx context.Context, config vc.VMConfig) (base.FactoryBase, error) {
|
|||||||
statePath := store.RunVMStoragePath + "/template"
|
statePath := store.RunVMStoragePath + "/template"
|
||||||
t := &template{statePath, config}
|
t := &template{statePath, config}
|
||||||
|
|
||||||
err := t.prepareTemplateFiles()
|
err := t.checkTemplateVM()
|
||||||
|
if err == nil {
|
||||||
|
return nil, fmt.Errorf("There is already a VM template in %s", statePath)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = t.prepareTemplateFiles()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user