mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 02:56:18 +00:00
cli: create vm factory if failed to load existing one
When vm factory is enabled, create vm factory automatically during creation. Fixes: #504 Signed-off-by: Peng Tao <bergwolf@gmail.com>
This commit is contained in:
parent
14d25b82a4
commit
4656a72b92
@ -120,8 +120,13 @@ func create(containerID, bundlePath, console, pidFilePath string, detach bool,
|
|||||||
kataLog.WithField("factory", factoryConfig).Info("load vm factory")
|
kataLog.WithField("factory", factoryConfig).Info("load vm factory")
|
||||||
f, err := vf.NewFactory(factoryConfig, true)
|
f, err := vf.NewFactory(factoryConfig, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
kataLog.WithError(err).Info("load vm factory failed")
|
kataLog.WithError(err).Warn("load vm factory failed, about to create new one")
|
||||||
} else {
|
f, err = vf.NewFactory(factoryConfig, false)
|
||||||
|
if err != nil {
|
||||||
|
kataLog.WithError(err).Warn("create vm factory failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
vci.SetFactory(f)
|
vci.SetFactory(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user