mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 15:57:09 +00:00
runtime: fix up disable_netns handling
With `disable_netns=true`, we should never scan the sandbox netns which is the host netns in such case. Fixes: #6021 Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
parent
1bae41a4d4
commit
12fd6ffc1f
@ -1250,11 +1250,11 @@ func (s *Sandbox) startVM(ctx context.Context, prestartHookFunc func(context.Con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// In case of vm factory, network interfaces are hotplugged
|
// 1. Do not scan the netns if we want no network for the vmm.
|
||||||
// after vm is started.
|
// 2. In case of vm factory, scan the netns to hotplug interfaces after vm is started.
|
||||||
// In case of prestartHookFunc, network config might have been changed.
|
// 3. In case of prestartHookFunc, network config might have been changed. We need to
|
||||||
// We need to rescan and handle the change.
|
// rescan and handle the change.
|
||||||
if s.factory != nil || prestartHookFunc != nil {
|
if !s.config.NetworkConfig.DisableNewNetwork && (s.factory != nil || prestartHookFunc != nil) {
|
||||||
if _, err := s.network.AddEndpoints(ctx, s, nil, true); err != nil {
|
if _, err := s.network.AddEndpoints(ctx, s, nil, true); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user