mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2025-01-29 21:47:19 +03:00
since wheezy, iscsiadm -m session throw an error code if no session exist.
So we can't bring up the iscsi storage This patch is based on the patch submitted by Alexandre, but we only suppress error messages when there are no active sessions. Other errors still trigges an exceptions.
This commit is contained in:
parent
5a0f42f880
commit
7acee37a30
@ -41,16 +41,20 @@ sub iscsi_session_list {
|
||||
|
||||
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, errmsg => 'iscsi session scan failed', 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;
|
||||
}
|
||||
});
|
||||
};
|
||||
if (my $err = $@) {
|
||||
die $err if $err !~ m/: No active sessions.$/i;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user