--- Begin Message ---
pvestatd is checking this every 10 seconds. This check
produces a lot of noise at the iscsi server logging.
Use iscsiadm command to check the sessions status instead
Signed-off-by: Victor Seva <linuxman...@torreviejawireless.org>
---
src/PVE/Storage/ISCSIPlugin.pm | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin.pm
index eb70453..6a69653 100644
--- a/src/PVE/Storage/ISCSIPlugin.pm
+++ b/src/PVE/Storage/ISCSIPlugin.pm
@@ -66,6 +66,25 @@ sub iscsi_test_portal {
return PVE::Network::tcp_ping($server, $port || 3260, 2);
}
+sub iscsi_test_session {
+ my ($portal, $sid) = @_;
+ my $cmd = [$ISCSIADM, '--mode', 'session', '--sid', $sid, '-P1'];
+
+ my $res = 0;
+ eval {
+ run_command($cmd, errmsg => 'iscsi session test failed', outfunc =>
sub {
+ my $line = shift;
+ if ($line =~ m/^\s+iSCSI Session State: LOGGED_IN\s*$/) {
+ $res = 1;
+ }
+ });
+ };
+ if (my $err = $@) {
+ die $err;
+ };
+ return $res;
+}
+
sub iscsi_portals {
my ($target, $portal_in) = @_;
@@ -561,10 +580,13 @@ sub check_connection {
my ($class, $storeid, $scfg) = @_;
my $portals = iscsi_portals($scfg->{target}, $scfg->{portal});
-
+ my $cache = {};
for my $portal (@$portals) {
- my $result = iscsi_test_portal($portal);
- return $result if $result;
+ my $sessions = iscsi_session($cache, $scfg->{target});
+ for my $session (@$sessions) {
+ my $result = iscsi_test_session($portal, $session->{session_id});
+ return $result if $result;
+ }
}
return 0;
--
2.43.0
--- End Message ---
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel