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 82AB41FF0B1 for ; Fri, 09 Oct 2026 05:16:16 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 08516213C3; Fri, 09 Oct 2026 05:16:16 +0200 (CEST) From: Kefu Chai To: pve-devel@lists.proxmox.com Subject: [PATCH manager] ceph: osd: create: accept multiple Ceph networks Date: Fri, 9 Oct 2026 11:15:55 +0800 Message-ID: <20261009031555.3414265-1-k.chai@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791515763760 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.388 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: XHI65YIV3NXQ6ESEJEGP4HKUQW52E2GT X-Message-ID-Hash: XHI65YIV3NXQ6ESEJEGP4HKUQW52E2GT 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: Ceph allows public_network and cluster_network to be a comma-separated list of subnets, and monitor creation has handled that since commit 0b6a2838 [0]. The OSD create check still passed the whole value to `ip address show to`, which rejects a list, so creating an OSD failed on every node of a cluster with more than one subnet. Check each subnet and accept the node if it has an address in any of them, since an OSD binds to one address. Also name the checked option in the error message: it always said "cluster network", even when the value came from the public_network fallback. [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 c5c20140..43bd5ac0 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