mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-03 02:26:37 +00:00
virtcontainers: Call stopVM() from sandbox.Stop()
Now that stopVM() also calls agent.stopSandbox(), we can have the sandbox Stop() call using stopVM() directly and avoid code duplication. Fixes: #1011 Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
acf833cb4a
commit
09168ccda7
@ -1254,10 +1254,12 @@ func (s *Sandbox) stopVM() error {
|
||||
span, _ := s.trace("stopVM")
|
||||
defer span.Finish()
|
||||
|
||||
s.Logger().Info("Stopping sandbox in the VM")
|
||||
if err := s.agent.stopSandbox(s); err != nil {
|
||||
s.Logger().WithError(err).WithField("sandboxid", s.id).Warning("Agent did not stop sandbox")
|
||||
}
|
||||
|
||||
s.Logger().Info("Stopping VM")
|
||||
return s.hypervisor.stopSandbox()
|
||||
}
|
||||
|
||||
@ -1592,12 +1594,7 @@ func (s *Sandbox) Stop() error {
|
||||
}
|
||||
}
|
||||
|
||||
if err := s.agent.stopSandbox(s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s.Logger().Info("Stopping VM")
|
||||
if err := s.hypervisor.stopSandbox(); err != nil {
|
||||
if err := s.stopVM(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user