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

Tobias Böhm tb at robhost.de
Fri Jul 28 10:26:43 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
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Please disregard this patch, as it sums up all devices of abstraction
layers and thus provides wrong values.

Regards,
Tobias



More information about the pve-devel mailing list