[pve-devel] r5120 - pve-storage/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Sep 13 08:39:13 CEST 2010


Author: dietmar
Date: 2010-09-13 06:39:13 +0000 (Mon, 13 Sep 2010)
New Revision: 5120

Modified:
   pve-storage/trunk/ChangeLog
   pve-storage/trunk/Makefile
   pve-storage/trunk/Storage.pm
   pve-storage/trunk/changelog.Debian
Log:


Modified: pve-storage/trunk/ChangeLog
===================================================================
--- pve-storage/trunk/ChangeLog	2010-09-10 15:50:47 UTC (rev 5119)
+++ pve-storage/trunk/ChangeLog	2010-09-13 06:39:13 UTC (rev 5120)
@@ -1,3 +1,7 @@
+2010-09-13  Proxmox Support Team  <support at proxmox.com>
+
+	* Storage.pm (storage_info): cache VGs, mountdata and iSCSI session list.
+
 2010-05-06  Proxmox Support Team  <support at proxmox.com>
 
 	* Storage.pm (storage_migrate): use --sparse and --whole-file, this also creates

Modified: pve-storage/trunk/Makefile
===================================================================
--- pve-storage/trunk/Makefile	2010-09-10 15:50:47 UTC (rev 5119)
+++ pve-storage/trunk/Makefile	2010-09-13 06:39:13 UTC (rev 5120)
@@ -2,7 +2,7 @@
 
 VERSION=1.0
 PACKAGE=libpve-storage-perl
-PKGREL=13
+PKGREL=14
 
 DESTDIR=
 PREFIX=/usr

Modified: pve-storage/trunk/Storage.pm
===================================================================
--- pve-storage/trunk/Storage.pm	2010-09-10 15:50:47 UTC (rev 5119)
+++ pve-storage/trunk/Storage.pm	2010-09-13 06:39:13 UTC (rev 5120)
@@ -2158,10 +2158,15 @@
 	    __activate_storage_full ($cfg, $baseid, $session);
 	}
 
+	if (!$session->{vgs}) {
+	    $session->{vgs} = lvm_vgs();
+	}
+
 	# In LVM2, vgscans take place automatically;
 	# this is just to be sure
-	my $res = lvm_vgs (); 
-	if (!$res->{$scfg->{vgname}}) {
+	if ($session->{vgs} && !$session->{vgscaned} && 
+	    !$session->{vgs}->{$scfg->{vgname}}) {
+	    $session->{vgscaned} = 1;
 	    my $cmd = ['/sbin/vgscan', '--ignorelockingfailure', '--mknodes'];
 	    eval { run_command ($cmd, outfunc => sub {}); };
 	    warn $@ if $@;
@@ -2203,9 +2208,9 @@
 }
 
 sub activate_storage_list {
-    my ($cfg, $storeid_list) = @_;
+    my ($cfg, $storeid_list, $session) = @_;
 
-    my $session = {};
+    $session = {} if !$session;
 
     foreach my $storeid (@$storeid_list) {
 	__activate_storage_full ($cfg, $storeid, $session);
@@ -2342,11 +2347,26 @@
 	push @$slist, $storeid;
     }
 
-    eval { activate_storage_list ($cfg, $slist); };
+    my $session = {};
+    my $mountdata = '';
+    my $iscsi_sessions = {};
+    my $vgs = {};
 
-    my $mountdata = $stypes->{nfs} ? read_proc_mounts() : '';
-    my $iscsi_sessions = $stypes->{iscsi} ? iscsi_session_list() : {};
+    if ($stypes->{lvm}) {
+	$session->{vgs} = lvm_vgs();
+	$vgs = $session->{vgs};
+    }
+    if ($stypes->{nfs}) {
+	$mountdata = read_proc_mounts();
+	$session->{mountdata} = $mountdata;
+    }
+    if ($stypes->{iscsi}) {
+	$iscsi_sessions = iscsi_session_list();
+	$session->{iscsi_sessions} = $iscsi_sessions;
+    } 
 
+    eval { activate_storage_list ($cfg, $slist, $session); };
+
     foreach my $storeid (keys %$ids) {
 	my $scfg = $ids->{$storeid};
 
@@ -2383,12 +2403,10 @@
 	    my $total = 0;
 	    my $free = 0;
 
-	    my $res = lvm_vgs (); 
+	    if (defined ($vgs->{$vgname})) {
+		$total = $vgs->{$vgname}->{size};
+		$free = $vgs->{$vgname}->{free};
 
-	    if (defined ($res->{$vgname})) {
-		$total = $res->{$vgname}->{size};
-		$free = $res->{$vgname}->{free};
-
 		$info->{$storeid}->{total} = $total; 
 		$info->{$storeid}->{avail} = $total; 
 		$info->{$storeid}->{used} = $total - $free; 

Modified: pve-storage/trunk/changelog.Debian
===================================================================
--- pve-storage/trunk/changelog.Debian	2010-09-10 15:50:47 UTC (rev 5119)
+++ pve-storage/trunk/changelog.Debian	2010-09-13 06:39:13 UTC (rev 5120)
@@ -1,3 +1,9 @@
+libpve-storage-perl (1.0-14) unstable; urgency=low
+
+  * better caching - avoid timeout bug with large number of VGs.
+
+ -- Proxmox Support Team <support at proxmox.com>  Mon, 13 Sep 2010 08:37:59 +0200
+
 libpve-storage-perl (1.0-13) unstable; urgency=low
 
   * fix sparse file migration - avoid overhead of previous solution



More information about the pve-devel mailing list