mirror of
https://github.com/containers/podman.git
synced 2025-10-13 17:26:13 +08:00
libpod: do not resuse networking on start
If a container was stopped and we try to start it before we called cleanup it tried to reuse the network which caused a panic as the pasta code cannot deal with that. It is also never correct as the netns must be created by the runtime in case of custom user namespaces used. As such the proper thing is to clean the netns up first. Also change a e2e test to report better errors. It is not directly related to this chnage but it failed on v1 of this patch so we noticed the ugly error message it produced. Thanks to Ed for the fix. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -71,6 +71,14 @@ func (c *Container) prepare() error {
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
if c.state.State == define.ContainerStateStopped {
|
||||
// networking should not be reused after a stop
|
||||
if err := c.cleanupNetwork(); err != nil {
|
||||
createNetNSErr = err
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Set up network namespace if not already set up
|
||||
noNetNS := c.state.NetNS == ""
|
||||
if c.config.CreateNetNS && noNetNS && !c.config.PostConfigureNetNS {
|
||||
|
Reference in New Issue
Block a user