all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH manager] ceph: osd: create: accept multiple Ceph networks
@ 2026-10-09  3:15 Kefu Chai
  0 siblings, 0 replies; only message in thread
From: Kefu Chai @ 2026-10-09  3:15 UTC (permalink / raw)
  To: pve-devel

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 <k.chai@proxmox.com>
---
 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





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-09  3:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09  3:15 [PATCH manager] ceph: osd: create: accept multiple Ceph networks Kefu Chai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal