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

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Aug 18 09:34:39 CEST 2011


Author: dietmar
Date: 2011-08-18 09:34:39 +0200 (Thu, 18 Aug 2011)
New Revision: 6492

Modified:
   pve-storage/trunk/ChangeLog
   pve-storage/trunk/Makefile
   pve-storage/trunk/Storage.pm
   pve-storage/trunk/changelog.Debian
Log:
 * iscsi: tolerate errors when not all portals are online.



Modified: pve-storage/trunk/ChangeLog
===================================================================
--- pve-storage/trunk/ChangeLog	2011-08-18 07:21:00 UTC (rev 6491)
+++ pve-storage/trunk/ChangeLog	2011-08-18 07:34:39 UTC (rev 6492)
@@ -1,3 +1,20 @@
+2011-08-18  Proxmox Support Team  <support at proxmox.com>
+ 	
+	* Storage.pm (iscsi_login): login to target, instead of
+	portal -  to make it work when one portal is offline.
+
+	* Storage.pm (iscsi_test_portal): test if portal in online (use 2
+	seconds timeout).
+
+	* Storage.pm (iscsi_discovery): test if portal is online using
+	iscsi_test_portal(). This avoids that we run int a timeout (iscsi
+	default timeout is 15 seconds, we now use 2 seconds)
+
+
+2011-07-29  Proxmox Support Team  <support at proxmox.com>
+
+	* Storage.pm (iscsi_login): allow errors
+
 2011-04-04  Proxmox Support Team  <support at proxmox.com>
 
 	* Storage.pm (load_stable_scsi_paths): fast way to find stable

Modified: pve-storage/trunk/Makefile
===================================================================
--- pve-storage/trunk/Makefile	2011-08-18 07:21:00 UTC (rev 6491)
+++ pve-storage/trunk/Makefile	2011-08-18 07:34:39 UTC (rev 6492)
@@ -2,7 +2,7 @@
 
 VERSION=1.0
 PACKAGE=libpve-storage-perl
-PKGREL=17
+PKGREL=18
 
 DESTDIR=
 PREFIX=/usr

Modified: pve-storage/trunk/Storage.pm
===================================================================
--- pve-storage/trunk/Storage.pm	2011-08-18 07:21:00 UTC (rev 6491)
+++ pve-storage/trunk/Storage.pm	2011-08-18 07:34:39 UTC (rev 6492)
@@ -16,6 +16,7 @@
 use Getopt::Long qw(GetOptionsFromArray);
 use Socket;
 use Digest::SHA1;
+use Net::Ping;
 
 my $ISCSIADM = '/usr/bin/iscsiadm';
 my $UDEVADM = '/sbin/udevadm';
@@ -1128,6 +1129,15 @@
     return $res;
 }
 
+sub iscsi_test_portal {
+    my ($portal) = @_;
+
+    my ($server, $port) = split(':', $portal);
+    my $p = Net::Ping->new("tcp", 2);
+    $p->port_number($port || 3260);
+    return $p->ping($server);
+}
+
 sub iscsi_discovery {
     my ($portal) = @_;
 
@@ -1137,6 +1147,9 @@
 	       '--portal', $portal];
 
     my $res = {};
+
+    return $res if !iscsi_test_portal($portal); # fixme: raise exception here?
+
     run_command ($cmd, outfunc => sub {
 	my $line = shift;
 
@@ -1156,13 +1169,11 @@
 
     check_iscsi_support ();
 
-    my $res = iscsi_discovery ($portal_in);
+    eval { iscsi_discovery ($portal_in); };
+    warn $@ if $@;
 
-    foreach my $portal (@{$res->{$target}}) {
-	my $cmd = [$ISCSIADM, '--mode', 'node', '--portal', $portal, 
-		   '--targetname',  $target, '--login'];
-	run_command ($cmd);
-    }
+    my $cmd = [$ISCSIADM, '--mode', 'node', '--targetname',  $target, '--login'];
+    run_command ($cmd);
 }
 
 sub iscsi_logout {
@@ -1170,8 +1181,7 @@
 
     check_iscsi_support ();
 
-    my $cmd = [$ISCSIADM, '--mode', 'node', '--portal', $portal, '--targetname', 
-	       $target, '--logout'];
+    my $cmd = [$ISCSIADM, '--mode', 'node', '--targetname', $target, '--logout'];
     run_command ($cmd);
 }
 

Modified: pve-storage/trunk/changelog.Debian
===================================================================
--- pve-storage/trunk/changelog.Debian	2011-08-18 07:21:00 UTC (rev 6491)
+++ pve-storage/trunk/changelog.Debian	2011-08-18 07:34:39 UTC (rev 6492)
@@ -1,3 +1,9 @@
+libpve-storage-perl (1.0-18) unstable; urgency=low
+
+  * iscsi: tolerate errors when not all portals are online.
+
+ -- Proxmox Support Team <support at proxmox.com>  Thu, 18 Aug 2011 09:32:13 +0200
+
 libpve-storage-perl (1.0-17) unstable; urgency=low
 
   * avoid delays when there are many iscsi devices (Alexandre)




More information about the pve-devel mailing list