mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-31 08:28:34 +00:00
Merge pull request #1103 from likebreath/1111/clh_fix_cleanupVM
runtime: clh: Enforce to call 'cleanupVM' for 'stopSandbox'
This commit is contained in:
@@ -764,7 +764,14 @@ func (clh *cloudHypervisor) terminate() (err error) {
|
||||
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 {
|
||||
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")
|
||||
}
|
||||
|
||||
if err := clh.cleanupVM(true); err != nil {
|
||||
return err
|
||||
clh.Logger().Debug("stop virtiofsd")
|
||||
if err = clh.virtiofsd.Stop(); err != nil {
|
||||
clh.Logger().Error("failed to stop virtiofsd")
|
||||
}
|
||||
|
||||
return clh.virtiofsd.Stop()
|
||||
return
|
||||
}
|
||||
|
||||
func (clh *cloudHypervisor) reset() {
|
||||
|
Reference in New Issue
Block a user