From aa080c3a7715251ce2fe4261207bf6e83ab706de Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Thu, 30 Nov 2023 18:03:02 -0500 Subject: [PATCH] qm: document systemd drop-in plus QM The spec file change for AllowedCPU won't affect ostree systems. This patch will document about using systemd drop-in plus QM. Signed-off-by: Douglas Schilling Landgraf --- qm.8.md | 16 ++++++++++++++++ qm.container | 3 ++- rpm/qm.spec | 11 ----------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/qm.8.md b/qm.8.md index 2e69b669..84a151fb 100644 --- a/qm.8.md +++ b/qm.8.md @@ -129,6 +129,22 @@ If you want permanently modify the bluechi agent within the QM you can add confi /usr/lib/qm/rootfs/etc/bluechi/agent.conf.d/ directory or modify the /etc/containers/systemd/qm.container quadlet file to not execute the bluechi-agent setup script. +## Using systemd drop-in with QM + +The systemd drop-in feature allows users to extend or modify the configuration of systemd units without directly editing the unit files provided by the system package. + +In this example, we will add the AllowedCPU to set as 1 to qm.service that quadlet generated: + +**Create allowedcpus.conf** + +```console +cat /etc/systemd/system/qm.service.d/allowedcpus.conf + +# Contents of qm.continer.d/allowedcpus.conf +[Service] +AllowedCPUs=1 +``` + ## SEE ALSO **[podman(1)](https://github.com/containers/podman/blob/main/docs/source/markdown/podman.1.md)**,**[quadlet(5)](https://github.com/containers/podman/blob/main/docs/source/markdown/podman-systemd.unit.5.md)**, systemctl(1), systemd(1), dnf(8), [bluechi-agent(1)](https://github.com/containers/bluechi/blob/main/doc/man/bluechi-agent.1.md),[bluechi-agent.conf.5](https://github.com/containers/bluechi/blob/main/doc/man/bluechi-agent.conf.5.md) diff --git a/qm.container b/qm.container index 9738b991..685391be 100644 --- a/qm.container +++ b/qm.container @@ -2,7 +2,8 @@ WantedBy=default.target [Service] -AllowedCPUs=1 +# It's recommended to use systemd drop-in to override the +# systemd settings. See QM manpage for an example. CPUWeight=50 Delegate=true IOWeight=50 diff --git a/rpm/qm.spec b/rpm/qm.spec index 9ac31cfc..d879c4f5 100644 --- a/rpm/qm.spec +++ b/rpm/qm.spec @@ -104,17 +104,6 @@ sed -i 's/^install: man all/install:/' Makefile %_format MODULES %{_datadir}/selinux/packages/$x.pp.bz2 %selinux_modules_install -s %{selinuxtype} $MODULES -# Set AllowedCPUs in quadlet file -NPROC=$(nproc) -if [[ $NPROC == 1 ]]; then - ALLOWED_CPUS=0 -elif [[ $NPROC == 2 ]]; then - ALLOWED_CPUS=1 -else - ALLOWED_CPUS=$(expr $NPROC / 2)"-"$(expr $NPROC - 1) -fi -sed "s/^AllowedCPUs=.*/AllowedCPUs=$ALLOWED_CPUS/" %{_datadir}/containers/systemd/%{name}.container > %{_sysconfdir}/containers/systemd/%{name}.container - %postun if [ $1 -eq 0 ]; then %selinux_modules_uninstall -s %{selinuxtype} %{modulenames}