[pve-devel] r6077 - in qemu-server/pve2: . PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Jun 15 07:48:33 CEST 2011


Author: dietmar
Date: 2011-06-15 07:48:33 +0200 (Wed, 15 Jun 2011)
New Revision: 6077

Modified:
   qemu-server/pve2/ChangeLog
   qemu-server/pve2/PVE/QemuServer.pm
Log:


Modified: qemu-server/pve2/ChangeLog
===================================================================
--- qemu-server/pve2/ChangeLog	2011-06-15 05:03:59 UTC (rev 6076)
+++ qemu-server/pve2/ChangeLog	2011-06-15 05:48:33 UTC (rev 6077)
@@ -1,5 +1,7 @@
 2011-06-15  Proxmox Support Team  <support at proxmox.com>
 
+	* PVE/QemuServer.pm (vmstatus): include IO stat
+
 	* qm (status): impl. verbose option 
 
 2011-03-09  Proxmox Support Team  <support at proxmox.com>

Modified: qemu-server/pve2/PVE/QemuServer.pm
===================================================================
--- qemu-server/pve2/PVE/QemuServer.pm	2011-06-15 05:03:59 UTC (rev 6076)
+++ qemu-server/pve2/PVE/QemuServer.pm	2011-06-15 05:48:33 UTC (rev 6077)
@@ -1680,6 +1680,9 @@
 	$d->{netout} = 0;
 	$d->{netin} = 0;
 
+	$d->{diskread} = 0;
+	$d->{diskwrite} = 0;
+
 	$res->{$vmid} = $d;
     }
 
@@ -1704,6 +1707,18 @@
 	my $pid = $d->{pid};
 	next if !$pid;
 
+	if (my $fh = IO::File->new("/proc/$pid/io", "r")) {
+	    my $data = {};
+	    while (defined (my $line = <$fh>)) {
+		if ($line =~ m/^([rw]char):\s+(\d+)$/) {
+		    $data->{$1} = $2;
+		}
+	    }
+	    close($fh);
+	    $d->{diskread} = $data->{rchar} || 0;
+	    $d->{diskwrite} = $data->{wchar} || 0;
+	}
+
 	my $statstr = file_read_firstline("/proc/$pid/stat");
 	next if !$statstr;
 
@@ -1752,7 +1767,6 @@
 	    $d->{cpu} = $old->{cpu};
 	    $d->{relcpu} = $old->{relcpu};
 	}
-
     }
 
     return $res;



More information about the pve-devel mailing list