For privileged containers a ns subgroup is created by lxc. Currently it is not used, except by pvestatd, but not for reading stats from. With this patch presence of ns subgroup is checked and if present values are read from and written to this subgroup.
Signed-off-by: Tobias Böhm <t...@robhost.de> --- src/PVE/LXC.pm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index 3beba8c..ab2cc22 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -251,6 +251,18 @@ sub vmstatus { return $list; } +sub get_cgroup_path { + my ($group, $vmid, $name) = @_; + + my $path = "/sys/fs/cgroup/$group/lxc/$vmid"; + + if (-d "$path/ns") { + $path .= "/ns"; + } + + return "$path/$name"; +} + sub read_cgroup_list { my ($group, $vmid, $name) = @_; @@ -262,7 +274,7 @@ sub read_cgroup_list { sub read_cgroup_value { my ($group, $vmid, $name, $full) = @_; - my $path = "/sys/fs/cgroup/$group/lxc/$vmid/$name"; + my $path = get_cgroup_path($group, $vmid, $name); return PVE::Tools::file_get_contents($path) if $full; @@ -272,7 +284,8 @@ sub read_cgroup_value { sub write_cgroup_value { my ($group, $vmid, $name, $value) = @_; - my $path = "/sys/fs/cgroup/$group/lxc/$vmid/$name"; + my $path = get_cgroup_path($group, $vmid, $name); + PVE::ProcFSTools::write_proc_entry($path, $value) if -e $path; } -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel