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

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Aug 4 07:27:27 CEST 2011


Author: dietmar
Date: 2011-08-04 07:27:27 +0200 (Thu, 04 Aug 2011)
New Revision: 6407

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

	* PVE/QemuServer.pm (config_list): use PVE::Cluster::get_vmlist()
	to avoid fuse filesystem overhead.



Modified: qemu-server/pve2/ChangeLog
===================================================================
--- qemu-server/pve2/ChangeLog	2011-08-04 04:37:52 UTC (rev 6406)
+++ qemu-server/pve2/ChangeLog	2011-08-04 05:27:27 UTC (rev 6407)
@@ -1,3 +1,8 @@
+2011-08-04  Proxmox Support Team  <support at proxmox.com>
+
+	* PVE/QemuServer.pm (config_list): use PVE::Cluster::get_vmlist()
+	to avoid fuse filesystem overhead.
+
 2011-07-06  Proxmox Support Team  <support at proxmox.com>
 
 	* PVE/API2/Qemu.pm (update_vm): check to avoid '-$opt' and

Modified: qemu-server/pve2/PVE/API2/Qemu.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu.pm	2011-08-04 04:37:52 UTC (rev 6406)
+++ qemu-server/pve2/PVE/API2/Qemu.pm	2011-08-04 05:27:27 UTC (rev 6407)
@@ -55,7 +55,7 @@
     code => sub {
 	my ($param) = @_;
 
-	my $vmstatus =  PVE::QemuServer::vmstatus();
+	my $vmstatus = PVE::QemuServer::vmstatus();
 
 	return PVE::RESTHandler::hash_to_array($vmstatus, 'vmid');
 

Modified: qemu-server/pve2/PVE/QemuServer.pm
===================================================================
--- qemu-server/pve2/PVE/QemuServer.pm	2011-08-04 04:37:52 UTC (rev 6406)
+++ qemu-server/pve2/PVE/QemuServer.pm	2011-08-04 05:27:27 UTC (rev 6407)
@@ -1502,16 +1502,16 @@
 }
 
 sub config_list {
-
-    my $fd = IO::Dir->new($confdir);
+    my $vmlist = PVE::Cluster::get_vmlist();
     my $res = {};
+    return $res if !$vmlist || !$vmlist->{ids};
+    my $ids = $vmlist->{ids};
 
-    return $res if !$fd;
-
-    while (defined(my $de = $fd->read)) { 
-	if ($de =~ m/^(\d+)\.conf$/) {
-	    $res->{$1}->{exists} = 1;
-	}
+    my $nodename = PVE::INotify::nodename();
+    foreach my $vmid (keys %$ids) {
+	my $d = $ids->{$vmid};
+	next if !$d->{node} || $d->{node} ne $nodename;
+	$res->{$vmid}->{exists} = 1;
     }
     return $res;
 }
@@ -1657,7 +1657,7 @@
 
     my $storecfg = PVE::Storage::config(); 
 
-    my $list =  vzlist();
+    my $list = vzlist();
     my ($uptime) = PVE::ProcFSTools::read_proc_uptime();
 
     foreach my $vmid (keys %$list) {




More information about the pve-devel mailing list