aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-06-25 14:54:28 +0200
committerGitHub <noreply@github.com>2019-06-25 14:54:28 +0200
commit21978c99088c04bcc847eb12f829876708c0b9e2 (patch)
treedcd97566680acc7ae18d6690619baa53e25250d8 /cmd/podman
parentd8b18a98791a49f5352d6a849cef7bff136cbb2c (diff)
parent53c3720de940ace048ca888caa3ab50d82b2f178 (diff)
downloadpodman-21978c99088c04bcc847eb12f829876708c0b9e2.tar.gz
podman-21978c99088c04bcc847eb12f829876708c0b9e2.tar.bz2
podman-21978c99088c04bcc847eb12f829876708c0b9e2.zip
Merge pull request #3332 from rhatdan/cgroupmanager
Correctly identify the defaults for cgroup-manager
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/main_local.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/cmd/podman/main_local.go b/cmd/podman/main_local.go
index 132f35ab5..7a062cb4b 100644
--- a/cmd/podman/main_local.go
+++ b/cmd/podman/main_local.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/libpodruntime"
+ "github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/pkg/tracing"
"github.com/containers/libpod/pkg/util"
@@ -25,8 +26,17 @@ import (
const remote = false
func init() {
-
- rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.CGroupManager, "cgroup-manager", "", "Cgroup manager to use (cgroupfs or systemd, default systemd)")
+ cgroupManager := libpod.SystemdCgroupsManager
+ if runtimeConfig, err := libpod.DefaultRuntimeConfig(); err == nil {
+ cgroupManager = runtimeConfig.CgroupManager
+ }
+ cgroupHelp := "Cgroup manager to use (cgroupfs or systemd)"
+ cgroupv2, _ := util.IsCgroup2UnifiedMode()
+ if rootless.IsRootless() && !cgroupv2 {
+ cgroupManager = ""
+ cgroupHelp = "Cgroup manager is not supported in rootless mode"
+ }
+ rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.CGroupManager, "cgroup-manager", cgroupManager, cgroupHelp)
// -c is deprecated due to conflict with -c on subcommands
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.CpuProfile, "cpu-profile", "", "Path for the cpu profiling results")
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.Config, "config", "", "Path of a libpod config file detailing container server configuration options")