Skip to content

Commit

Permalink
Merge pull request #1254 from mheon/systemd_cgroups_default
Browse files Browse the repository at this point in the history
Switch default CGroup manager to systemd
  • Loading branch information
mheon authored Aug 11, 2018
2 parents 3ef9279 + a9b73ab commit 7d116f5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ dbuild: libpodimage
docker run --name=${LIBPOD_INSTANCE} --privileged ${LIBPOD_IMAGE} -v ${PWD}:/go/src/${PROJECT} --rm ${ENTRYPOINT} make binaries

test: libpodimage
docker run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} ${ENTRYPOINT} make clean all localunit localintegration
docker run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e CGROUP_MANAGER=cgroupfs -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} ${ENTRYPOINT} make clean all localunit localintegration

integration: libpodimage
docker run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} ${ENTRYPOINT} make clean all localintegration
docker run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e CGROUP_MANAGER=cgroupfs -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} ${ENTRYPOINT} make clean all localintegration

integration.fedora:
DIST=Fedora sh .papr_prepare.sh
Expand All @@ -160,10 +160,10 @@ integration.centos:
DIST=CentOS sh .papr_prepare.sh

shell: libpodimage
docker run --tmpfs -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e TRAVIS -it --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} ${ENTRYPOINT} sh
docker run --tmpfs -e STORAGE_OPTIONS="--storage-driver=vfs" -e CGROUP_MANAGER=cgroupfs -e TESTFLAGS -e TRAVIS -it --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} ${ENTRYPOINT} sh

testunit: libpodimage
docker run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} ${ENTRYPOINT} make localunit
docker run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e CGROUP_MANAGER=cgroupfs -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} ${ENTRYPOINT} make localunit

localunit: varlink_generate
$(GO) test -tags "$(BUILDTAGS)" -cover $(PACKAGES)
Expand Down
1 change: 1 addition & 0 deletions contrib/python/podman/test/podman_testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def run_cmd(*args):
tmpdir = os.environ.get('TMPDIR', '/tmp')
podman_args = [
'--storage-driver=vfs',
'--cgroup-manager=cgroupfs',
'--root={}/crio'.format(tmpdir),
'--runroot={}/crio-run'.format(tmpdir),
'--cni-config-dir={}/cni/net.d'.format(tmpdir),
Expand Down
1 change: 1 addition & 0 deletions contrib/python/podman/test/test_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ PODMAN_ARGS="--storage-driver=vfs \
--root=${TMPDIR}/crio \
--runroot=${TMPDIR}/crio-run \
--cni-config-dir=$CNI_CONFIG_PATH \
--cgroup-manager=cgroupfs \
"
if [[ -n $VERBOSE ]]; then
PODMAN_ARGS="$PODMAN_ARGS --log-level=$LOG_LEVEL"
Expand Down
2 changes: 1 addition & 1 deletion libpod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ conmon_env_vars = [
]

# CGroup Manager - valid values are "systemd" and "cgroupfs"
cgroup_manager = "cgroupfs"
cgroup_manager = "systemd"

# Directory for persistent libpod files (database, etc)
# By default, this will be configured relative to where containers/storage
Expand Down
2 changes: 1 addition & 1 deletion libpod/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ var (
ConmonEnvVars: []string{
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
},
CgroupManager: CgroupfsCgroupsManager,
CgroupManager: SystemdCgroupsManager,
HooksDir: hooks.DefaultDir,
StaticDir: filepath.Join(storage.DefaultStoreOptions.GraphRoot, "libpod"),
TmpDir: "",
Expand Down
11 changes: 9 additions & 2 deletions test/e2e/libpod_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (
CNI_CONFIG_DIR string
RUNC_BINARY string
INTEGRATION_ROOT string
CGROUP_MANAGER = "systemd"
STORAGE_OPTIONS = "--storage-driver vfs"
ARTIFACT_DIR = "/tmp/.artifacts"
CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx, redis, registry}
Expand Down Expand Up @@ -60,6 +61,7 @@ type PodmanTest struct {
SignaturePolicyPath string
ArtifactPath string
TempDir string
CgroupManager string
}

// HostOS is a simple struct for the test os
Expand Down Expand Up @@ -141,6 +143,10 @@ func PodmanCreate(tempDir string) PodmanTest {
if os.Getenv("STORAGE_OPTIONS") != "" {
storageOptions = os.Getenv("STORAGE_OPTIONS")
}
cgroupManager := CGROUP_MANAGER
if os.Getenv("CGROUP_MANAGER") != "" {
cgroupManager = os.Getenv("CGROUP_MANAGER")
}

runCBinary := "/usr/bin/runc"
CNIConfigDir := "/etc/cni/net.d"
Expand All @@ -156,6 +162,7 @@ func PodmanCreate(tempDir string) PodmanTest {
SignaturePolicyPath: filepath.Join(INTEGRATION_ROOT, "test/policy.json"),
ArtifactPath: ARTIFACT_DIR,
TempDir: tempDir,
CgroupManager: cgroupManager,
}

// Setup registries.conf ENV variable
Expand All @@ -165,8 +172,8 @@ func PodmanCreate(tempDir string) PodmanTest {

//MakeOptions assembles all the podman main options
func (p *PodmanTest) MakeOptions() []string {
return strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s",
p.CrioRoot, p.RunRoot, p.RunCBinary, p.ConmonBinary, p.CNIConfigDir), " ")
return strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s",
p.CrioRoot, p.RunRoot, p.RunCBinary, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
}

// Podman is the exec call to podman on the filesystem, uid and gid the credentials to use
Expand Down

0 comments on commit 7d116f5

Please sign in to comment.