since wheezy, iscsiadm -m session throw an error code if no session exist.

So we can't bring up the iscsi storage

Signed-off-by: Alexandre Derumier <aderum...@odiso.com>
---
 PVE/Storage/ISCSIPlugin.pm |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/PVE/Storage/ISCSIPlugin.pm b/PVE/Storage/ISCSIPlugin.pm
index 8da7ec5..8065dc6 100644
--- a/PVE/Storage/ISCSIPlugin.pm
+++ b/PVE/Storage/ISCSIPlugin.pm
@@ -40,18 +40,17 @@ sub iscsi_session_list {
     my $cmd = [$ISCSIADM, '--mode', 'session'];
 
     my $res = {};
-
-    run_command($cmd, outfunc => sub {
-       my $line = shift;
-
-       if ($line =~ m/^tcp:\s+\[(\S+)\]\s+\S+\s+(\S+)\s*$/) {
-           my ($session, $target) = ($1, $2);
-           # there can be several sessions per target (multipath)
-           push @{$res->{$target}}, $session;
-
+    eval{
+       run_command($cmd, outfunc => sub {
+           my $line = shift;
+
+           if ($line =~ m/^tcp:\s+\[(\S+)\]\s+\S+\s+(\S+)\s*$/) {
+               my ($session, $target) = ($1, $2);
+               # there can be several sessions per target (multipath)
+               push @{$res->{$target}}, $session;
        }
     });
-
+};
     return $res;
 }
 
-- 
1.7.10.4

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to