mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
runtime: clh: Enforce to call 'cleanupVM' for 'stopSandbox'
We should always cleanup the vm directory when doing `stopSandbox`, while we are skipping the cleanup process on some error code paths when using cloud-hypervisor driver. Fixes: #1098 Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
095dace7d6
commit
647331ace6
@ -764,7 +764,14 @@ func (clh *cloudHypervisor) terminate() (err error) {
|
|||||||
pidRunning = false
|
pidRunning = false
|
||||||
}
|
}
|
||||||
|
|
||||||
clh.Logger().WithField("PID", pid).Info("Stopping Cloud Hypervisor")
|
defer func() {
|
||||||
|
clh.Logger().Debug("cleanup VM")
|
||||||
|
if err1 := clh.cleanupVM(true); err1 != nil {
|
||||||
|
clh.Logger().WithError(err1).Error("failed to cleanupVM")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
clh.Logger().Debug("Stopping Cloud Hypervisor")
|
||||||
|
|
||||||
if pidRunning {
|
if pidRunning {
|
||||||
clhRunning, _ := clh.isClhRunning(clhStopSandboxTimeout)
|
clhRunning, _ := clh.isClhRunning(clhStopSandboxTimeout)
|
||||||
@ -808,11 +815,12 @@ func (clh *cloudHypervisor) terminate() (err error) {
|
|||||||
return errors.New("virtiofsd config is nil, failed to stop it")
|
return errors.New("virtiofsd config is nil, failed to stop it")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := clh.cleanupVM(true); err != nil {
|
clh.Logger().Debug("stop virtiofsd")
|
||||||
return err
|
if err = clh.virtiofsd.Stop(); err != nil {
|
||||||
|
clh.Logger().Error("failed to stop virtiofsd")
|
||||||
}
|
}
|
||||||
|
|
||||||
return clh.virtiofsd.Stop()
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clh *cloudHypervisor) reset() {
|
func (clh *cloudHypervisor) reset() {
|
||||||
|
Loading…
Reference in New Issue
Block a user