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

svn-commits at proxmox.com svn-commits at proxmox.com
Fri May 13 12:06:22 CEST 2011


Author: dietmar
Date: 2011-05-13 12:06:22 +0200 (Fri, 13 May 2011)
New Revision: 5977

Modified:
   qemu-server/pve2/PVE/API2/Qemu.pm
   qemu-server/pve2/PVE/QemuServer.pm
Log:
optimize


Modified: qemu-server/pve2/PVE/API2/Qemu.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu.pm	2011-05-13 09:59:00 UTC (rev 5976)
+++ qemu-server/pve2/PVE/API2/Qemu.pm	2011-05-13 10:06:22 UTC (rev 5977)
@@ -547,7 +547,7 @@
 	# test if VM exists
 	my $conf = PVE::QemuServer::load_config ($param->{vmid});
 
-	my $vmstatus =  PVE::QemuServer::vmstatus();
+	my $vmstatus =  PVE::QemuServer::vmstatus($param->{vmid});
 
 	return $vmstatus->{$param->{vmid}};
     }});

Modified: qemu-server/pve2/PVE/QemuServer.pm
===================================================================
--- qemu-server/pve2/PVE/QemuServer.pm	2011-05-13 09:59:00 UTC (rev 5976)
+++ qemu-server/pve2/PVE/QemuServer.pm	2011-05-13 10:06:22 UTC (rev 5977)
@@ -1637,6 +1637,8 @@
 my $last_proc_pid_stat;
 
 sub vmstatus {
+    my ($opt_vmid) = @_;
+
     my $res = {};
 
     my $storecfg = PVE::Storage::config(); 
@@ -1645,6 +1647,8 @@
     my ($uptime) = PVE::ProcFSTools::read_proc_uptime();
 
     foreach my $vmid (keys %$list) {
+	next if $opt_vmid && ($vmid ne $opt_vmid);
+
 	my $cfspath = cfs_config_path($vmid);
 	my $conf = PVE::Cluster::cfs_read_file($cfspath) || {};
 




More information about the pve-devel mailing list