Skip to content

Commit

Permalink
build: only use --cpuset options when the cgroup controller is available
Browse files Browse the repository at this point in the history
Fixes: ceph#1670
Signed-off-by: Niels de Vos <[email protected]>
  • Loading branch information
nixpanic committed Dec 22, 2020
1 parent 9096659 commit 31d1d1d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ CONTAINER_CMD?=$(shell podman version >/dev/null 2>&1 && echo podman)
ifeq ($(CONTAINER_CMD),)
CONTAINER_CMD=$(shell docker version >/dev/null 2>&1 && echo docker)
endif
CPUS?=$(shell nproc --ignore=1)
CPUSET?=--cpuset-cpus=0-${CPUS}

# Recent versions of Podman do not allow non-root to use --cpuset options.
# Set HAVE_CPUSET to 1 when cpuset support is available.
ifeq ($(UID),0)
HAVE_CPUSET ?= $(shell grep -c -w cpuset /sys/fs/cgroup/cgroup.controllers 2>/dev/null)
else
HAVE_CPUSET ?= $(shell grep -c -w cpuset /sys/fs/cgroup/user.slice/user-$(UID).slice/cgroup.controllers 2>/dev/null)
endif
ifeq ($(HAVE_CPUSET),1)
CPUS ?= $(shell nproc --ignore=1)
CPUSET ?= --cpuset-cpus=0-${CPUS}
endif

CSI_IMAGE_NAME=$(if $(ENV_CSI_IMAGE_NAME),$(ENV_CSI_IMAGE_NAME),quay.io/cephcsi/cephcsi)
CSI_IMAGE_VERSION=$(shell . $(CURDIR)/build.env ; echo $${CSI_IMAGE_VERSION})
Expand Down

0 comments on commit 31d1d1d

Please sign in to comment.