Re: [pve-devel] [PATCH] lxc : vmstatus : add disk read|write stats
On Sun, 21 Jun 2015 13:06:27 +0200 Alexandre Derumier aderum...@odiso.com wrote: + my ($key, $value) = $byte =~ /(Read|Write) (\d+)/; I think this would be more secure: my ($key, $value) = $byte =~ /(Read|Write)\s+(\d+)/; -- Hilsen/Regards Michael Rasmussen Get my public GnuPG keys: michael at rasmussen dot cc http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xD3C9A00E mir at datanom dot net http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xE501F51C mir at miras dot org http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xE3E80917 -- /usr/games/fortune -es says: True, it returns for false, but is an even more interesting number than 0. -- Larry Wall in 199707300650.xaa05...@wall.org pgp_XaUyjpiWU.pgp Description: OpenPGP digital signature ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH] lxc : vmstatus : add disk read|write stats
applied, with small improvement requested by mir (just to be safe). ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH] lxc : vmstatus : add disk read|write stats
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 aderum...@odiso.com --- src/PVE/LXC.pm | 8 1 file changed, 8 insertions(+) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index 0f21bcb..30f735c 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -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) (\d+)/; + $d-{diskread} = $2 if $key eq 'Read'; + $d-{diskwrite} = $2 if $key eq 'Write'; + } } return $list; -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel