diff options
Diffstat (limited to 'libpod/options.go')
-rw-r--r-- | libpod/options.go | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libpod/options.go b/libpod/options.go index 06737776b..e22c81f91 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -149,6 +149,7 @@ func WithOCIRuntime(runtime string) RuntimeOption { } rt.config.OCIRuntime = runtime + rt.config.RuntimePath = nil return nil } @@ -394,6 +395,22 @@ func WithDefaultInfraCommand(cmd string) RuntimeOption { } } +// WithRenumber instructs libpod to perform a lock renumbering while +// initializing. This will handle migrations from early versions of libpod with +// file locks to newer versions with SHM locking, as well as changes in the +// number of configured locks. +func WithRenumber() RuntimeOption { + return func(rt *Runtime) error { + if rt.valid { + return ErrRuntimeFinalized + } + + rt.doRenumber = true + + return nil + } +} + // Container Creation Options // WithShmDir sets the directory that should be mounted on /dev/shm. @@ -887,10 +904,10 @@ func WithNetNS(portMappings []ocicni.PortMapping, postConfigureNetNS bool, netmo } ctr.config.PostConfigureNetNS = postConfigureNetNS - ctr.config.CreateNetNS = true + ctr.config.NetMode = namespaces.NetworkMode(netmode) + ctr.config.CreateNetNS = !ctr.config.NetMode.IsUserDefined() ctr.config.PortMappings = portMappings ctr.config.Networks = networks - ctr.config.NetMode = namespaces.NetworkMode(netmode) return nil } |