mirror of https://github.com/containers/podman.git
Fix netavark error handling and teardown issue
The return error was not returned by podman , instead a different error was created. Also make sure to free assigned ips on an error to not leak them. Lastly podman container cleanup uses the default network backend instead of the provided one, we need to add `--network-backend` to the exit command. [NO NEW TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
bfc929efc4
commit
044edbb9c9
|
@ -55,7 +55,15 @@ func (n *netavarkNetwork) Setup(namespacePath string, options types.SetupOptions
|
||||||
|
|
||||||
result := map[string]types.StatusBlock{}
|
result := map[string]types.StatusBlock{}
|
||||||
err = n.execNetavark([]string{"setup", namespacePath}, netavarkOpts, &result)
|
err = n.execNetavark([]string{"setup", namespacePath}, netavarkOpts, &result)
|
||||||
|
if err != nil {
|
||||||
|
// lets dealloc ips to prevent leaking
|
||||||
|
if err := n.deallocIPs(&options.NetworkOptions); err != nil {
|
||||||
|
logrus.Error(err)
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure that the result makes sense
|
||||||
if len(result) != len(options.Networks) {
|
if len(result) != len(options.Networks) {
|
||||||
logrus.Errorf("unexpected netavark result: %v", result)
|
logrus.Errorf("unexpected netavark result: %v", result)
|
||||||
return nil, fmt.Errorf("unexpected netavark result length, want (%d), got (%d) networks", len(options.Networks), len(result))
|
return nil, fmt.Errorf("unexpected netavark result length, want (%d), got (%d) networks", len(options.Networks), len(result))
|
||||||
|
|
|
@ -295,6 +295,7 @@ func CreateExitCommandArgs(storageConfig storageTypes.StoreOptions, config *conf
|
||||||
"--cgroup-manager", config.Engine.CgroupManager,
|
"--cgroup-manager", config.Engine.CgroupManager,
|
||||||
"--tmpdir", config.Engine.TmpDir,
|
"--tmpdir", config.Engine.TmpDir,
|
||||||
"--cni-config-dir", config.Network.NetworkConfigDir,
|
"--cni-config-dir", config.Network.NetworkConfigDir,
|
||||||
|
"--network-backend", config.Network.NetworkBackend,
|
||||||
}
|
}
|
||||||
if config.Engine.OCIRuntime != "" {
|
if config.Engine.OCIRuntime != "" {
|
||||||
command = append(command, []string{"--runtime", config.Engine.OCIRuntime}...)
|
command = append(command, []string{"--runtime", config.Engine.OCIRuntime}...)
|
||||||
|
|
Loading…
Reference in New Issue