[pve-devel] [PATCH container 2/2] Fix block stats bytes counter

Tobias Böhm tb at robhost.de
Wed Jul 26 16:40:42 CEST 2017


Instead of setting the bytes count, sum it This way stats from all
devices are accumulated, instead of only stats from the last device in
the file are set.

Signed-off-by: Tobias Böhm <tb at robhost.de>
---
 src/PVE/LXC.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index ab2cc22..99bdc16 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -199,8 +199,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';
 	    }
 	}
 
-- 
2.11.0




More information about the pve-devel mailing list