Adapt libvirtd to work with cgroupv2

This commit is contained in:
RouxAntoine 2021-04-26 23:24:36 +02:00
parent ebd073a56c
commit 7375e560b4
Signed by: antoine
GPG Key ID: 098FB66FC0475E70
2 changed files with 11 additions and 8 deletions

View File

@ -1,10 +1,11 @@
.PHONY: imageLibvirtd test
REGISTRY_IP=docker.registry
DOCKER_BUILDKIT=1
## build
shell_build_image = docker build -t $(REGISTRY_IP):5000/$(1) .; \
shell_build_image = docker build --platform=linux/amd64 -t $(REGISTRY_IP):5000/$(1) .; \
docker push $(REGISTRY_IP):5000/$(1);
imageLibvirtd:
@ -29,4 +30,4 @@ download_centos:
## management
status:
@curl -s $(REGISTRY_IP):5000/v2/_catalog | jq
@curl -s $(REGISTRY_IP):5000/v2/_catalog | jq

View File

@ -36,12 +36,14 @@ modprobe kvm_intel nested=1 -d /host
# If no cpuacct,cpu is present, symlink it to cpu,cpuacct
# Otherwise libvirt and our emulator get confused
if [ ! -d "/host/sys/fs/cgroup/cpuacct,cpu" ]; then
echo "Creating cpuacct,cpu cgroup symlink"
mount -o remount,rw /host/sys/fs/cgroup
cd /host/sys/fs/cgroup
ln -s cpu,cpuacct cpuacct,cpu
mount -o remount,ro /host/sys/fs/cgroup
if [ ! -f "/host/sys/fs/cgroup/cgroup.controllers" ]; then
if [ ! -d "/host/sys/fs/cgroup/cpuacct,cpu" ]; then
echo "Creating cpuacct,cpu cgroup symlink"
mount -o remount,rw /host/sys/fs/cgroup
cd /host/sys/fs/cgroup
ln -s cpu,cpuacct cpuacct,cpu
mount -o remount,ro /host/sys/fs/cgroup
fi
fi
mount --rbind /host/sys/fs/cgroup /sys/fs/cgroup