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

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Apr 4 06:59:38 CEST 2011


Author: dietmar
Date: 2011-04-04 06:59:38 +0200 (Mon, 04 Apr 2011)
New Revision: 5778

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	2011-04-01 12:30:12 UTC (rev 5777)
+++ pve-storage/trunk/ChangeLog	2011-04-04 04:59:38 UTC (rev 5778)
@@ -1,3 +1,8 @@
+2011-04-04  Proxmox Support Team  <support at proxmox.com>
+
+	* Storage.pm (load_stable_scsi_paths): fast way to find stable
+	paths (patch from Alexandre).
+
 2010-11-08  Proxmox Support Team  <support at proxmox.com>
 
 	* Storage.pm (iscsi_login): multipath fixes: log in to all portals

Modified: pve-storage/trunk/Makefile
===================================================================
--- pve-storage/trunk/Makefile	2011-04-01 12:30:12 UTC (rev 5777)
+++ pve-storage/trunk/Makefile	2011-04-04 04:59:38 UTC (rev 5778)
@@ -1,8 +1,8 @@
-RELEASE=1.6
+RELEASE=1.8
 
 VERSION=1.0
 PACKAGE=libpve-storage-perl
-PKGREL=16
+PKGREL=17
 
 DESTDIR=
 PREFIX=/usr

Modified: pve-storage/trunk/Storage.pm
===================================================================
--- pve-storage/trunk/Storage.pm	2011-04-01 12:30:12 UTC (rev 5777)
+++ pve-storage/trunk/Storage.pm	2011-04-04 04:59:38 UTC (rev 5778)
@@ -209,6 +209,30 @@
     return $name;
 }
 
+sub load_stable_scsi_paths {
+
+    my $stable_paths = {};
+
+    my $stabledir = "/dev/disk/by-id";
+
+    if (my $dh = IO::Dir->new($stabledir)) {
+       while (defined(my $tmp = $dh->read)) {
+           # exclude filenames with part in name (same disk but partitions)
+           # use only filenames with scsi(with multipath i have the same device 
+	   # with dm-uuid-mpath , dm-name and scsi in name)
+           if($tmp !~ m/-part\d+$/ && $tmp =~ m/^scsi-/) {
+                 my $path = "$stabledir/$tmp";
+                 my $bdevdest = readlink($path);
+		 if ($bdevdest && $bdevdest =~ m|^../../([^/]+)|) {
+		     $stable_paths->{$1}=$tmp;
+		 }
+	   }
+       }
+       $dh->close;
+    }
+    return $stable_paths;
+}
+
 sub dir_glob_regex {
     my ($dir, $regex) = @_;
 
@@ -1186,6 +1210,8 @@
 
     my $dirname = '/sys/class/iscsi_session';
 
+    my $stable_paths = load_stable_scsi_paths();
+
     dir_glob_foreach ($dirname, 'session(\d+)', sub {
 	my ($ent, $session) = @_;
 
@@ -1215,7 +1241,7 @@
 		$bdev = $multipathdev if $multipathdev;
 	    }
 
-	    my $blockdev = find_dev_by_id ("/dev/$bdev");
+	    my $blockdev = $stable_paths->{$bdev};
 	    return if !$blockdev;
 
 	    my $size = file_read_firstline ("/sys/block/$bdev/size");

Modified: pve-storage/trunk/changelog.Debian
===================================================================
--- pve-storage/trunk/changelog.Debian	2011-04-01 12:30:12 UTC (rev 5777)
+++ pve-storage/trunk/changelog.Debian	2011-04-04 04:59:38 UTC (rev 5778)
@@ -1,3 +1,9 @@
+libpve-storage-perl (1.0-17) unstable; urgency=low
+
+  * avoid delays when there are many iscsi devices (Alexandre)
+
+ -- Proxmox Support Team <support at proxmox.com>  Mon, 04 Apr 2011 06:58:29 +0200
+
 libpve-storage-perl (1.0-16) unstable; urgency=low
 
   * multipath fix: login to all portals




More information about the pve-devel mailing list