mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-30 01:02:33 +00:00
template: Add check if vm template is on before vm template initialize
Add check if vm template is on before vm template initialize. Fixes: #1514 Signed-off-by: Hui Zhu <teawater@hyper.sh>
This commit is contained in:
parent
717a30bfe0
commit
76a5076e56
@ -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