Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
sandbox: remove network before stopping vm
Browse files Browse the repository at this point in the history
We might need to call hypervisor hotunplug to really remove
a network device. We cannot do it after stopping the VM.

Fixes: #1956
Signed-off-by: Peng Tao <[email protected]>
  • Loading branch information
bergwolf committed Aug 13, 2019
1 parent 9ea469b commit 794e08e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions virtcontainers/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -1473,16 +1473,16 @@ func (s *Sandbox) Stop(force bool) error {
}
}

if err := s.stopVM(); err != nil && !force {
// Remove the network.
if err := s.removeNetwork(); err != nil && !force {
return err
}

if err := s.setSandboxState(types.StateStopped); err != nil {
if err := s.stopVM(); err != nil && !force {
return err
}

// Remove the network.
if err := s.removeNetwork(); err != nil && !force {
if err := s.setSandboxState(types.StateStopped); err != nil {
return err
}

Expand Down

0 comments on commit 794e08e

Please sign in to comment.