Hi Lennart, Thanks for the response. I am fairly new to systemd, may be I am not familiar with exact systemd terminology. I am starting the container using the command either "machinectl start appscont" or "systemctl status systemd-nspawn@appscont" after "systemctl daemon-reload" override.conf is effective when it is placed in /etc/systemd/system/systemd-nspawn@service.d/ If I have file systemd-nspawn@appscont.service in /etc/systemd/system.control/systemd-nspawn@appscont.service.d, it is not effective, it's using the template file. Please let me know, Where exactly am I supposed to drop-in and what should be the name of the unit file ? Regards Mahipal
On Wednesday, 18 July, 2018, 3:15:56 PM GMT-4, Lennart Poettering <lenn...@poettering.net> wrote: On Mi, 18.07.18 19:10, patlollamahi...@yahoo.co.in (patlollamahi...@yahoo.co.in) wrote: > Hi All,I am using systemd-nspawn(systemd version 237) to create a container >in Yocto's embedded Linux environment on Cortex-A53 > > Content of the file > > > /etc/systemd/system/systemd-nspawn\@.service.d/override.conf > > is[Service]ExecStart=ExecStart=/usr/bin/systemd-nspawn --quiet --boot > --link-journal=try-guest --machine=%i -n --property=CPUQuota=10%I am trying > to load the CPU with > > sha1sum /dev/zero & > > > or > > > for i in 1 2 3 4; do while : ; do : ; done & done > > > inside the container but the top command on host shows that always > they are at 50% CPU usage altogether(4 sh processes and one sha1sum > process, if only sha1sum process is started, it alone uses 50% if > not 10% each) I am unable to understand if there is any other > setting where this 50% limitation is coming from? And why CPU quota > passed to systemd-nspawn is not effective?I also tried > with /etc/systemd/system/systemd-nspawn@.service.d/cpu.conf, still > the same result but if I pass MemoryMax=50M, process gets killed if > i try to use more than 50M in total inside the container.If anyone > knows please help. Thank nspawn's --property= is only relevant if nspawn allocates a scope unit for the container. But that's not what systemd-nspawn@.service is for: in that case nspawn simply makes use of the service unit it is already run in. This is documented in the man page, if you have a look. Or in other words: in your unit file drop-in just place CPUQuota= directly in your [Service] Section: [Service] CPUQuota=10% And do not make any changes to ExecStart=. Lennart -- Lennart Poettering, Red Hat
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel