diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2022-06-21 17:57:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-21 17:57:24 +0000 |
commit | fe974101ebc30d7902d29daa2e7832e61041f46e (patch) | |
tree | 3736a7b2920d2d0abff3393268dc9d556f2a06a7 /cmd/podman | |
parent | b8b0fa80454fe0f3bcdab24bbf17cf0b6c2e8661 (diff) | |
parent | f451b68dfa71d3690d49bc0cf3536b77cd6572d0 (diff) | |
download | podman-fe974101ebc30d7902d29daa2e7832e61041f46e.tar.gz podman-fe974101ebc30d7902d29daa2e7832e61041f46e.tar.bz2 podman-fe974101ebc30d7902d29daa2e7832e61041f46e.zip |
Merge pull request #14625 from cdoern/podShm
podman pod create --shm-size
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/common/create.go | 14 | ||||
-rw-r--r-- | cmd/podman/containers/create.go | 6 | ||||
-rw-r--r-- | cmd/podman/pods/clone.go | 6 |
3 files changed, 16 insertions, 10 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go index 40bb0df78..e25bdd241 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -452,13 +452,6 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions, ) _ = cmd.RegisterFlagCompletionFunc(secretFlagName, AutocompleteSecrets) - shmSizeFlagName := "shm-size" - createFlags.String( - shmSizeFlagName, shmSize(), - "Size of /dev/shm "+sizeWithUnitFormat, - ) - _ = cmd.RegisterFlagCompletionFunc(shmSizeFlagName, completion.AutocompleteNone) - stopSignalFlagName := "stop-signal" createFlags.StringVar( &cf.StopSignal, @@ -628,6 +621,13 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions, ) } if isInfra || (!clone && !isInfra) { // infra container flags, create should also pick these up + shmSizeFlagName := "shm-size" + createFlags.String( + shmSizeFlagName, shmSize(), + "Size of /dev/shm "+sizeWithUnitFormat, + ) + _ = cmd.RegisterFlagCompletionFunc(shmSizeFlagName, completion.AutocompleteNone) + sysctlFlagName := "sysctl" createFlags.StringSliceVar( &cf.Sysctl, diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go index a214ae8aa..c021aa031 100644 --- a/cmd/podman/containers/create.go +++ b/cmd/podman/containers/create.go @@ -217,9 +217,6 @@ func CreateInit(c *cobra.Command, vals entities.ContainerCreateOptions, isInfra } if !isInfra { - if c.Flag("shm-size").Changed { - vals.ShmSize = c.Flag("shm-size").Value.String() - } if c.Flag("cpu-period").Changed && c.Flag("cpus").Changed { return vals, errors.Errorf("--cpu-period and --cpus cannot be set together") } @@ -283,6 +280,9 @@ func CreateInit(c *cobra.Command, vals entities.ContainerCreateOptions, isInfra return vals, errors.Errorf("--userns and --pod cannot be set together") } } + if c.Flag("shm-size").Changed { + vals.ShmSize = c.Flag("shm-size").Value.String() + } if (c.Flag("dns").Changed || c.Flag("dns-opt").Changed || c.Flag("dns-search").Changed) && vals.Net != nil && (vals.Net.Network.NSMode == specgen.NoNetwork || vals.Net.Network.IsContainer()) { return vals, errors.Errorf("conflicting options: dns and the network mode: " + string(vals.Net.Network.NSMode)) } diff --git a/cmd/podman/pods/clone.go b/cmd/podman/pods/clone.go index d95d74b05..391af1cf7 100644 --- a/cmd/podman/pods/clone.go +++ b/cmd/podman/pods/clone.go @@ -46,6 +46,7 @@ func cloneFlags(cmd *cobra.Command) { common.DefineCreateDefaults(&podClone.InfraOptions) common.DefineCreateFlags(cmd, &podClone.InfraOptions, true, false) + podClone.InfraOptions.MemorySwappiness = -1 // this is not implemented for pods yet, need to set -1 default manually // need to fill an empty ctr create option for each container for sane defaults @@ -72,6 +73,11 @@ func clone(cmd *cobra.Command, args []string) error { } podClone.ID = args[0] + + if cmd.Flag("shm-size").Changed { + podClone.InfraOptions.ShmSize = cmd.Flag("shm-size").Value.String() + } + podClone.PerContainerOptions.IsClone = true rep, err := registry.ContainerEngine().PodClone(context.Background(), podClone) if err != nil { |