[pve-devel] [PATCH] eval iscsiadm -m session
Alexandre Derumier
aderumier at odiso.com
Sun May 12 08:02:27 CEST 2013
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 <aderumier at 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
More information about the pve-devel
mailing list