diff --git a/virtcontainers/sandbox.go b/virtcontainers/sandbox.go index f8f744fd5a..7b8a79352c 100644 --- a/virtcontainers/sandbox.go +++ b/virtcontainers/sandbox.go @@ -1473,6 +1473,11 @@ func (s *Sandbox) Stop(force bool) error { } } + // Remove the network. + if err := s.removeNetwork(); err != nil && !force { + return err + } + if err := s.stopVM(); err != nil && !force { return err } @@ -1481,11 +1486,6 @@ func (s *Sandbox) Stop(force bool) error { return err } - // Remove the network. - if err := s.removeNetwork(); err != nil && !force { - return err - } - if err := s.storeSandbox(); err != nil { return err }