diff options
-rw-r--r-- | cmd/podman/build.go | 9 | ||||
-rw-r--r-- | cmd/podman/common.go | 11 | ||||
-rw-r--r-- | completions/bash/podman | 20 | ||||
-rw-r--r-- | docs/podman-build.1.md | 2 | ||||
-rw-r--r-- | docs/podman-create.1.md | 10 | ||||
-rw-r--r-- | docs/podman-run.1.md | 10 | ||||
-rwxr-xr-x | hack/man-page-checker | 23 | ||||
-rw-r--r-- | pkg/adapter/runtime_remote.go | 12 | ||||
-rw-r--r-- | pkg/util/utils_supported.go | 2 |
9 files changed, 70 insertions, 29 deletions
diff --git a/cmd/podman/build.go b/cmd/podman/build.go index 14ac51889..8eb12cacd 100644 --- a/cmd/podman/build.go +++ b/cmd/podman/build.go @@ -10,6 +10,7 @@ import ( "github.com/containers/buildah/imagebuildah" buildahcli "github.com/containers/buildah/pkg/cli" "github.com/containers/libpod/cmd/podman/cliconfig" + "github.com/containers/libpod/libpod" "github.com/containers/libpod/pkg/adapter" "github.com/docker/go-units" "github.com/opencontainers/runtime-spec/specs-go" @@ -225,6 +226,14 @@ func buildCmd(c *cliconfig.BuildValues) error { for _, arg := range c.RuntimeFlags { runtimeFlags = append(runtimeFlags, "--"+arg) } + + conf, err := runtime.GetConfig() + if err != nil { + return err + } + if conf != nil && conf.CgroupManager == libpod.SystemdCgroupsManager { + runtimeFlags = append(runtimeFlags, "--systemd-cgroup") + } // end from buildah defer runtime.DeferredShutdown(false) diff --git a/cmd/podman/common.go b/cmd/podman/common.go index 32478bb51..9724d18c6 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -22,7 +22,8 @@ var ( ) const ( - idTruncLength = 12 + idTruncLength = 12 + sizeWithUnitFormat = "(format: `<number>[<unit>]`, where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))" ) func splitCamelCase(src string) string { @@ -302,7 +303,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) { ) createFlags.String( "kernel-memory", "", - "Kernel memory limit (format: `<number>[<unit>]`, where unit = b, k, m or g)", + "Kernel memory limit "+sizeWithUnitFormat, ) createFlags.StringArrayP( "label", "l", []string{}, @@ -326,11 +327,11 @@ func getCreateFlags(c *cliconfig.PodmanCommand) { ) createFlags.StringP( "memory", "m", "", - "Memory limit (format: <number>[<unit>], where unit = b, k, m or g)", + "Memory limit "+sizeWithUnitFormat, ) createFlags.String( "memory-reservation", "", - "Memory soft limit (format: <number>[<unit>], where unit = b, k, m or g)", + "Memory soft limit "+sizeWithUnitFormat, ) createFlags.String( "memory-swap", "", @@ -422,7 +423,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) { ) createFlags.String( "shm-size", cliconfig.DefaultShmSize, - "Size of `/dev/shm`. The format is `<number><unit>`", + "Size of /dev/shm "+sizeWithUnitFormat, ) createFlags.String( "stop-signal", "", diff --git a/completions/bash/podman b/completions/bash/podman index ec660712b..041703810 100644 --- a/completions/bash/podman +++ b/completions/bash/podman @@ -1,3 +1,7 @@ +# +# This bash script was originally copied and converted from the upstream +# github.com:docker/docker project +# : ${PROG:=$(basename ${BASH_SOURCE})} @@ -1412,20 +1416,24 @@ _podman_import() { --quiet -q " - _complete_ "$options_with_args" "$boolean_options" + case "$prev" in + --change|-c|--message|-m) + return + ;; + esac case "$cur" in -*) COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur")) ;; *) - local counter=$( __podman_pos_first_nonflag "$options_with_args" ) - if [ "$cword" -eq "$((counter))" ]; then - __podman_complete_images --repo --tag - return - else + local counter=$(__podman_pos_first_nonflag '--change|-c|--message|-m') + if [ "$cword" -eq "$counter" ]; then _filedir return + elif [ "$cword" -eq "$((counter + 1))" ]; then + __podman_complete_images --repo --tag + return fi ;; esac diff --git a/docs/podman-build.1.md b/docs/podman-build.1.md index 74c07ab73..20f4d6aab 100644 --- a/docs/podman-build.1.md +++ b/docs/podman-build.1.md @@ -281,7 +281,7 @@ with 3 being roughly equivalent to using the global *--debug* option, and values below 0 omitting even error messages which accompany fatal errors. **--memory**, **-m**=*LIMIT* -Memory limit (format: <number>[<unit>], where unit = b, k, m or g) +Memory limit (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes)) Allows you to constrain the memory available to a container. If the host supports swap memory, then the **-m** memory setting can be larger than physical diff --git a/docs/podman-create.1.md b/docs/podman-create.1.md index cee9a1640..9924e7dff 100644 --- a/docs/podman-create.1.md +++ b/docs/podman-create.1.md @@ -379,7 +379,7 @@ Default is to create a private IPC namespace (POSIX SysV IPC) for the container **--kernel-memory**=*number[unit]* -Kernel memory limit (format: `<number>[<unit>]`, where unit = b, k, m or g) +Kernel memory limit (format: `<number>[<unit>]`, where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes)) Constrains the kernel memory available to a container. If a limit of 0 is specified (not using `--kernel-memory`), the container's kernel memory @@ -421,7 +421,7 @@ Not currently supported **--memory**, **-m**=*limit* -Memory limit (format: <number>[<unit>], where unit = b, k, m or g) +Memory limit (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes)) Allows you to constrain the memory available to a container. If the host supports swap memory, then the **-m** memory setting can be larger than physical @@ -431,7 +431,7 @@ system's page size (the value would be very large, that's millions of trillions) **--memory-reservation**=*limit* -Memory soft limit (format: <number>[<unit>], where unit = b, k, m or g) +Memory soft limit (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes)) After setting memory reservation, when the system detects memory contention or low memory, containers are forced to restrict their consumption to their @@ -661,9 +661,9 @@ Note: Labeling can be disabled for all containers by setting label=false in the **--shm-size**=*size* -Size of `/dev/shm`. The format is `<number><unit>`. `number` must be greater than `0`. -Unit is optional and can be `b` (bytes), `k` (kilobytes), `m`(megabytes), or `g` (gigabytes). +Size of `/dev/shm` (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes)) If you omit the unit, the system uses bytes. If you omit the size entirely, the system uses `64m`. +When size is `0`, there is no limit on the amount of memory used for IPC by the container. **--stop-signal**=*SIGTERM* diff --git a/docs/podman-run.1.md b/docs/podman-run.1.md index 8fb7453fe..c642b50b6 100644 --- a/docs/podman-run.1.md +++ b/docs/podman-run.1.md @@ -390,7 +390,7 @@ Default is to create a private IPC namespace (POSIX SysV IPC) for the container **--kernel-memory**=*number[unit]* -Kernel memory limit (format: `<number>[<unit>]`, where unit = b, k, m or g) +Kernel memory limit (format: `<number>[<unit>]`, where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes)) Constrains the kernel memory available to a container. If a limit of 0 is specified (not using `--kernel-memory`), the container's kernel memory @@ -432,7 +432,7 @@ Not currently supported **--memory**, **-m**=*limit* -Memory limit (format: <number>[<unit>], where unit = b, k, m or g) +Memory limit (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes)) Allows you to constrain the memory available to a container. If the host supports swap memory, then the **-m** memory setting can be larger than physical @@ -442,7 +442,7 @@ system's page size (the value would be very large, that's millions of trillions) **--memory-reservation**=*limit* -Memory soft limit (format: <number>[<unit>], where unit = b, k, m or g) +Memory soft limit (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes)) After setting memory reservation, when the system detects memory contention or low memory, containers are forced to restrict their consumption to their @@ -683,9 +683,9 @@ Note: Labeling can be disabled for all containers by setting label=false in the **--shm-size**=*size* -Size of `/dev/shm`. The format is `<number><unit>`. `number` must be greater than `0`. -Unit is optional and can be `b` (bytes), `k` (kilobytes), `m`(megabytes), or `g` (gigabytes). +Size of `/dev/shm` (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes)) If you omit the unit, the system uses bytes. If you omit the size entirely, the system uses `64m`. +When size is `0`, there is no limit on the amount of memory used for IPC by the container. **--sig-proxy**=*true|false* diff --git a/hack/man-page-checker b/hack/man-page-checker index ab1921b86..30d0b2113 100755 --- a/hack/man-page-checker +++ b/hack/man-page-checker @@ -30,8 +30,11 @@ for md in *.1.md;do # care only about the first. name=$(egrep -A1 '^#* NAME' $md|tail -1|awk '{print $1}' | tr -d \\\\) - if [ "$name" != "$(basename $md .1.md)" ]; then - printf "%-32s NAME= %s\n" $md $name + expect=$(basename $md .1.md) + if [ "$name" != "$expect" ]; then + echo + printf "Inconsistent program NAME in %s:\n" $md + printf " NAME= %s (expected: %s)\n" $name $expect rc=1 fi done @@ -57,8 +60,11 @@ for md in $(ls -1 *-*.1.md | grep -v remote);do if [ "$desc" != "$parent_desc" ]; then echo + printf "Inconsistent subcommand descriptions:\n" printf " %-32s = '%s'\n" $md "$desc" printf " %-32s = '%s'\n" $parent "$parent_desc" + printf "Please ensure that the NAME section of $md\n" + printf "matches the subcommand description in $parent\n" rc=1 fi done @@ -82,16 +88,21 @@ for md in *.1.md;do # arguments are bracketed by single ones. # E.g. '**podman volume inspect** [*options*] *volume*...' # Get the command name, and confirm that it matches the md file name. - cmd=$(echo "$synopsis" | sed -e 's/\(.*\)\*\*.*/\1/' | tr -d \* | tr ' ' '-') - if [ "$md" != "$cmd.1.md" ]; then - printf " %-32s SYNOPSIS = %s\n" $md "$cmd" + cmd=$(echo "$synopsis" | sed -e 's/\(.*\)\*\*.*/\1/' | tr -d \*) + md_nodash=$(basename "$md" .1.md | tr '-' ' ') + if [ "$cmd" != "$md_nodash" -a "$cmd" != "podman-remote" ]; then + echo + printf "Inconsistent program name in SYNOPSIS in %s:\n" $md + printf " SYNOPSIS = %s (expected: '%s')\n" "$cmd" "$md_nodash" rc=1 fi # The convention is to use UPPER CASE in 'podman foo --help', # but *lower case bracketed by asterisks* in the man page if expr "$synopsis" : ".*[A-Z]" >/dev/null; then - printf " %-32s UPPER-CASE '%s'\n" $md "$synopsis" + echo + printf "Inconsistent capitalization in SYNOPSIS in %s\n" $md + printf " '%s' should not contain upper-case characters\n" "$synopsis" rc=1 fi diff --git a/pkg/adapter/runtime_remote.go b/pkg/adapter/runtime_remote.go index 8588966b6..718a6d542 100644 --- a/pkg/adapter/runtime_remote.go +++ b/pkg/adapter/runtime_remote.go @@ -113,6 +113,18 @@ func (r RemoteRuntime) DeferredShutdown(force bool) { } } +// RuntimeConfig is a bogus wrapper for compat with the libpod runtime +type RuntimeConfig struct { + // CGroupManager is the CGroup Manager to use + // Valid values are "cgroupfs" and "systemd" + CgroupManager string +} + +// Shutdown is a bogus wrapper for compat with the libpod runtime +func (r *RemoteRuntime) GetConfig() (*RuntimeConfig, error) { + return nil, nil +} + // Shutdown is a bogus wrapper for compat with the libpod runtime func (r RemoteRuntime) Shutdown(force bool) error { return nil diff --git a/pkg/util/utils_supported.go b/pkg/util/utils_supported.go index 707e193e9..253460686 100644 --- a/pkg/util/utils_supported.go +++ b/pkg/util/utils_supported.go @@ -83,7 +83,7 @@ func GetRootlessConfigHomeDir() (string, error) { logrus.Errorf("unable to make temp dir %s", tmpDir) } st, err := os.Stat(tmpDir) - if err == nil && int(st.Sys().(*syscall.Stat_t).Uid) == os.Geteuid() && st.Mode().Perm() == 0755 { + if err == nil && int(st.Sys().(*syscall.Stat_t).Uid) == os.Geteuid() && st.Mode().Perm() >= 0700 { cfgHomeDir = tmpDir } } |