From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 5DE6E1FF17B for ; Tue, 5 Nov 2024 17:38:24 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BB7AE342B3; Tue, 5 Nov 2024 17:38:32 +0100 (CET) From: Friedrich Weber To: pve-devel@lists.proxmox.com Date: Tue, 5 Nov 2024 17:37:44 +0100 Message-Id: <20241105163744.84687-1-f.weber@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.024 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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_NONE 0.001 SPF: HELO does not publish an 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] Subject: [pve-devel] [PATCH storage] iscsi: fix activation of second iSCSI storage on other cluster nodes X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Assume a cluster that already has an iSCSI storage A configured. After adding a new iSCSI storage B with a different target on node 1, B will only become active on node 1, not on the other nodes. On other nodes, pvestatd logs 'storage B is not online'. The storage does not become available even after a reboot. A workaround is to manually perform iSCSI discovery against B's targets on the other nodes once. This happens because the connectivity check of the iSCSI plugin on node B does not correctly handle the case that iscsiadm already knows portals (i.e., A's portals) but not B's portals. The connectivity check calls `iscsi_portals` to determine the portals to ping, which calls `iscsiadm -m node` to query all known portals, and extracts all portals to the storage's target. If the iscsiadm command fails, `iscsi_portals` returns the portal given in the storage config. This works as expected if the storage is the first iSCSI storage, because then iscsiadm does not know any portals and thus exits with code 21. However, since there already is an iSCSI storage A, iscsiadm exits cleanly but its output does not contain any portals for B's target. Hence, `iscsi_portals` returns an empty array of portals, so the connectivity check fails and node 2 never performs discovery for B. To fix this, let `iscsi_portals` also return the portal from B's storage config if iscsiadm exited cleanly but its output contained no matching portal. Signed-off-by: Friedrich Weber --- src/PVE/Storage/ISCSIPlugin.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin.pm index 2e3d6ee..0211bbe 100644 --- a/src/PVE/Storage/ISCSIPlugin.pm +++ b/src/PVE/Storage/ISCSIPlugin.pm @@ -86,12 +86,14 @@ sub iscsi_portals { }); }; - if ($@) { - warn $@; + my $err = $@; + warn $err if $err; + + if ($err || !scalar(@$res)) { return [ $portal_in ]; + } else { + return $res; } - - return $res; } sub iscsi_discovery { -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel