mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 08:47:56 +00:00
sandbox: remove network before stopping vm
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 <bergwolf@hyper.sh>
This commit is contained in:
parent
9ea469bcfa
commit
794e08e243
@ -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 {
|
if err := s.stopVM(); err != nil && !force {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1481,11 +1486,6 @@ func (s *Sandbox) Stop(force bool) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the network.
|
|
||||||
if err := s.removeNetwork(); err != nil && !force {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := s.storeSandbox(); err != nil {
|
if err := s.storeSandbox(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user