[pve-devel] [PATCH container] fixes #1227: include ns/ dir in read_cgroup_value

Philip Abernethy p.abernethy at proxmox.com
Fri Oct 6 15:52:15 CEST 2017


this fixes the disk I/O graph and now also correctly sums the values.
---
This fix is already somewhat obsoleted by cgroup v2, but targetting
that will me much more effort.
 src/PVE/LXC.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index bce032a..6246e7b 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -197,8 +197,8 @@ sub vmstatus {
 	my @bytes = split(/\n/, $blkio_bytes);
 	foreach my $byte (@bytes) {
 	    if (my ($key, $value) = $byte =~ /(Read|Write)\s+(\d+)/) {
-		$d->{diskread} = $2 if $key eq 'Read';
-		$d->{diskwrite} = $2 if $key eq 'Write';
+		$d->{diskread} += $2 if $key eq 'Read';
+		$d->{diskwrite} += $2 if $key eq 'Write';
 	    }
 	}
 
@@ -260,7 +260,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 = "/sys/fs/cgroup/$group/lxc/$vmid/ns/$name";
 
     return PVE::Tools::file_get_contents($path) if $full;
 
-- 
2.11.0





More information about the pve-devel mailing list