From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 0D3851FF0BC for ; Thu, 29 Oct 2026 04:54:40 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id A5EE0215CA; Thu, 29 Oct 2026 04:54:27 +0100 (CET) From: Kefu Chai To: pve-devel@lists.proxmox.com Subject: [PATCH manager v2 1/1] fix #5327: ceph: osd: create: accept multiple Ceph networks Date: Thu, 29 Oct 2026 11:54:18 +0800 Message-ID: <20261029035418.3324517-2-k.chai@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261029035418.3324517-1-k.chai@proxmox.com> References: <20261029035418.3324517-1-k.chai@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793246063852 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.267 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: JZWKEHTUBOXTCWEM3PWTOSB7UANVSRZN X-Message-ID-Hash: JZWKEHTUBOXTCWEM3PWTOSB7UANVSRZN X-MailFrom: k.chai@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: public_network and cluster_network can hold a list of subnets, separated by commas or spaces. Monitor creation has supported that since commit 0b6a2838 [0], but the OSD create check still passed the whole value to `ip address show to`. ip rejects a list, so OSD creation failed on every node of a cluster with more than one subnet. Split the value like monitor creation does, and accept the node if it has an address in any of the subnets. An OSD only binds to one address, so one match is enough. While at it, name the checked option in the error message. It always said "cluster network", even when the value came from the public_network fallback. This was also reported as #8087. [0] https://bugzilla.proxmox.com/show_bug.cgi?id=2422 Signed-off-by: Kefu Chai --- PVE/API2/Ceph/OSD.pm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm index 7ff006d2..539b55bb 100644 --- a/PVE/API2/Ceph/OSD.pm +++ b/PVE/API2/Ceph/OSD.pm @@ -6,6 +6,7 @@ use warnings; use Cwd qw(abs_path); use IO::File; use JSON; +use List::Util qw(any); use UUID; use PVE::Ceph::Tools; @@ -340,17 +341,18 @@ __PACKAGE__->register_method({ my $ceph_conf = cfs_read_file('ceph.conf'); + my $osd_net_opt = 'cluster_network'; my $osd_network = $ceph_conf->{global}->{cluster_network}; - $osd_network //= $ceph_conf->{global}->{public_network}; # fallback - - if ($osd_network) { # check only if something is configured - my $cluster_net_ips = PVE::Network::get_local_ip_from_cidr($osd_network); - if (scalar(@$cluster_net_ips) < 1) { - my $osd_net_obj = PVE::Network::IP_from_cidr($osd_network); - my $osd_base_cidr = $osd_net_obj->{ip} . "/" . $osd_net_obj->{prefixlen}; + if (!$osd_network) { # fallback, also when empty like ceph does + $osd_net_opt = 'public_network'; + $osd_network = $ceph_conf->{global}->{public_network}; + } + my @osd_nets = PVE::Tools::split_list($osd_network); + if (@osd_nets) { # check only if something is configured + if (!any { scalar(@{ PVE::Network::get_local_ip_from_cidr($_) }) } @osd_nets) { die - "No address from ceph cluster network (${osd_base_cidr}) found on node '$nodename'. " + "No address from ceph $osd_net_opt ($osd_network) found on node '$nodename'. " . "Check your network config.\n"; } } -- 2.47.3