mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-21 09:25:19 +00:00
virtcontainers: Don't handle the network in case of a factory
If the sandbox has been initialized with a factory, this means the caller should be in charge of adding any network to the VM, and virtcontainers library cannot make any assumptions about adding the default underlying network. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
9c6ed93f80
commit
97d280ee0c
@ -973,6 +973,16 @@ func (s *Sandbox) createNetwork() error {
|
||||
span, _ := s.trace("createNetwork")
|
||||
defer span.Finish()
|
||||
|
||||
// In case there is a factory, the network should be handled
|
||||
// through some calls at the API level, in order to add or
|
||||
// remove interfaces and routes.
|
||||
// This prevents from any assumptions that could be made from
|
||||
// virtcontainers, in particular that the VM has not been started
|
||||
// before it starts to scan the current network.
|
||||
if s.factory != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Add the network
|
||||
if err := s.network.add(s); err != nil {
|
||||
return err
|
||||
@ -986,6 +996,13 @@ func (s *Sandbox) removeNetwork() error {
|
||||
span, _ := s.trace("removeNetwork")
|
||||
defer span.Finish()
|
||||
|
||||
// In case there is a factory, the network has been handled through
|
||||
// some API calls to hotplug some interfaces and routes. This means
|
||||
// the removal of the network should follow the same logic.
|
||||
if s.factory != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return s.network.remove(s)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user