]> git.proxmox.com Git - pve-container.git/commitdiff
lxc : vmstatus : add disk read|write stats
authorAlexandre Derumier <aderumier@odiso.com>
Sun, 21 Jun 2015 11:06:27 +0000 (13:06 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Sun, 21 Jun 2015 14:23:54 +0000 (16:23 +0200)
using cgroup blkio.throttle.io_service_bytes

They are also another cgroup blkio.io_service_bytes,
but it's only work with cfq io scheduler.

blkio.throttle.io_service_bytes works with any io scheduler

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
src/PVE/LXC.pm

index 733fe4fa7371de98432380608a1703b73da709ae..bce66dff3caa9fb80ddf8da64940cee164f16c86 100644 (file)
@@ -752,6 +752,14 @@ sub vmstatus {
 
        $d->{mem} = read_cgroup_value('memory', $vmid, 'memory.usage_in_bytes');
        $d->{swap} = read_cgroup_value('memory', $vmid, 'memory.memsw.usage_in_bytes') - $d->{mem};
+
+       my $blkio_bytes = read_cgroup_value('blkio', $vmid, 'blkio.throttle.io_service_bytes', 1);
+       my @bytes = split /\n/, $blkio_bytes;
+       foreach my $byte (@bytes) {
+           my ($key, $value) = $byte =~ /(Read|Write)\s+(\d+)/;
+           $d->{diskread} = $2 if $key eq 'Read';
+           $d->{diskwrite} = $2 if $key eq 'Write';
+       }
     }
     
     return $list;