From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id A43F51FF15C for <inbox@lore.proxmox.com>; Wed, 5 Mar 2025 23:06:51 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A85F21F312; Wed, 5 Mar 2025 23:06:45 +0100 (CET) To: pve-devel@lists.proxmox.com Date: Wed, 5 Mar 2025 22:59:37 +0100 MIME-Version: 1.0 Message-ID: <mailman.800.1741212404.293.pve-devel@lists.proxmox.com> List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Post: <mailto:pve-devel@lists.proxmox.com> From: Victor Seva via pve-devel <pve-devel@lists.proxmox.com> Precedence: list Cc: Victor Seva <linuxmaniac@torreviejawireless.org> X-Mailman-Version: 2.1.29 X-BeenThere: pve-devel@lists.proxmox.com List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> Subject: [pve-devel] [PATCH] fix #957 iscsi: don't check tcp connection directly Content-Type: multipart/mixed; boundary="===============5048658110008181697==" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> --===============5048658110008181697== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: <linuxmaniac@torreviejawireless.org> X-Original-To: pve-devel@lists.proxmox.com Delivered-To: pve-devel@lists.proxmox.com Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 62872D3CC5 for <pve-devel@lists.proxmox.com>; Wed, 5 Mar 2025 23:06:44 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 41CB21F2DA for <pve-devel@lists.proxmox.com>; Wed, 5 Mar 2025 23:06:44 +0100 (CET) Received: from mail-106109.protonmail.ch (mail-106109.protonmail.ch [79.135.106.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for <pve-devel@lists.proxmox.com>; Wed, 5 Mar 2025 23:06:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=torreviejawireless.org; s=protonmail; t=1741211988; x=1741471188; bh=9TNjOYYZSEDeBnwPK3PBwT6of+go4o+UNR26Ke8W1Co=; h=From:To:Cc:Subject:Date:Message-ID:From:To:Cc:Date:Subject: Reply-To:Feedback-ID:Message-ID:BIMI-Selector:List-Unsubscribe: List-Unsubscribe-Post; b=H7L1Lodr0/fjlIwWj9a3lP72XSVrryo3kQKYG8jBefLiQCmunqdbAQ91fWtKE/GLO zEJK/EnKjrDT/3Z8sRB6n5rWYCpGooDEDbGFL5bgxySUqz9ThxFLokot8A4sRW5My9 dyqPQfjYLDciGF7e2803Kfd7qlBg+lCeXYYwOMTfMPZPxNct8CRiKWG1wZZcJ6i1JR LX1AbpsMkFdkL64vluUP/DKalhzr3odc9PKexQVc8N4sny46NtsEYYJIFaCUpOCIpB BxMauuVMpVh7seuqVliq661I586tOt6WuKD/r65nFH1Y/poyXH43RY6udBpC0t9/cY pI7gXy6rm3X/Q== X-Pm-Submission-Id: 4Z7RKv3WPZz4C7 From: Victor Seva <linuxmaniac@torreviejawireless.org> To: pve-devel@lists.proxmox.com Subject: [PATCH] fix #957 iscsi: don't check tcp connection directly Date: Wed, 5 Mar 2025 22:59:37 +0100 Message-ID: <20250305215937.53650-1-linuxmaniac@torreviejawireless.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_PASS -0.001 SPF: HELO matches SPF record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [iscsiplugin.pm,torreviejawireless.org] 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 <linuxmaniac@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 --===============5048658110008181697== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel --===============5048658110008181697==--