nproc shows all hosts cores in lxc despite limitiation

avekrivoy

Member
May 19, 2017
12
0
21
36
Hi!
I'm having problem with resource limiting on Proxmox
All CPUs of Proxmox host are available inside LXC-container, despite limit is set.
Code:
pct config 100

arch: amd64
cpulimit: 1
cpuunits: 1024
hostname: test
memory: 1024
net0: name=eth0,bridge=vmbr0,hwaddr=BE:C9:EB:5E:0E:15,type=veth
ostype: debian
rootfs: local:100/vm-100-disk-1.raw,size=8G
swap: 512

pct enter 100

root@test:~# nproc
8

root@test:~# cat /proc/cpuinfo | grep cores | wc -l
8

Proxmox host is running on Debian Jessie.
Code:
pveversion
pve-manager/4.2-23/d94f9458 (running kernel: 4.4.19-1-pve)
I have another host with 4.4.59-1-pve kernel and there is no such problem.
Is there a way to fix this without updating whole host? Maybe LXC part only?
 
You need to set the 'cores' configuration (cpulimit only limits performance, but does not reduce the number of assigned cores)
 
You need to set the 'cores' configuration (cpulimit only limits performance, but does not reduce the number of assigned cores)
oh, right, newer version of Proxmox has field Cores at container creation menu.
So I tried to edit my container config and add
Code:
cores: 2
but operation failed:
Code:
pct stop 100
vm 100 - unable to parse value of 'cores' - unknown setting 'cores'
 
What version do you run exactly? Maybe you still run an old version?
Code:
pveversion -v
proxmox-ve: 4.2-66 (running kernel: 4.4.19-1-pve)
pve-manager: 4.2-23 (running version: 4.2-23/d94f9458)
pve-kernel-4.4.19-1-pve: 4.4.19-66
lvm2: 2.02.111-2.2+deb8u1
corosync-pve: 2.4.0-1
libqb0: 1.0-1
pve-cluster: 4.0-46
qemu-server: 4.0-88
pve-firmware: 1.1-9
libpve-common-perl: 4.0-73
libpve-access-control: 4.0-19
libpve-storage-perl: 4.0-61
pve-libspice-server1: 0.12.8-1
vncterm: 1.2-1
pve-qemu-kvm: 2.6.1-6
pve-container: 1.0-75
pve-firewall: 2.0-29
pve-ha-manager: 1.0-35
ksm-control-daemon: 1.2-1
glusterfs-client: 3.5.2-2+deb8u2
lxc-pve: 2.0.7-4
lxcfs: 2.0.6-pve1
criu: 1.6.0-1
novnc-pve: 0.5-8
And I've updated lxc-pve and lxcfs manually by apt install.
 
is it possible to make partial upgrade without reboot?

Normally, you can to a full-upgrade without a reboot. Kernel changes are normally only security fixes, not feature improvements. You need to restart your containers to get the new configuration stuff. Normally one would restart every service that is affected by an update, so most people just reboot their servers to be on the safe side. I'd recommend that too for most people :-D
 
Normally, you can to a full-upgrade without a reboot. Kernel changes are normally only security fixes, not feature improvements. You need to restart your containers to get the new configuration stuff. Normally one would restart every service that is affected by an update, so most people just reboot their servers to be on the safe side. I'd recommend that too for most people :-D
Eh, those are risky things for production environment) But, I guess, I have no other options. Thank you for response!