[pve-devel] [PATCH manager 1/2] ceph: do not check ips if no network is configured

Dominik Csapak d.csapak at proxmox.com
Mon Feb 24 12:01:35 CET 2020


the network and the cluster network are optional in the ceph config
and with 'pveceph init', so only check if we have an ip address
from those networks if it is actually configured

otherwise, the createosd call dies with an 'ip' error message
even if it would work

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Ceph/OSD.pm | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
index e1b0d807..a514c502 100644
--- a/PVE/API2/Ceph/OSD.pm
+++ b/PVE/API2/Ceph/OSD.pm
@@ -284,13 +284,15 @@ __PACKAGE__->register_method ({
 	my $osd_network = $ceph_conf->{global}->{cluster_network};
 	$osd_network //= $ceph_conf->{global}->{public_network}; # fallback
 
-	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};
-
-	    die "No address from ceph cluster network (${osd_base_cidr}) found on node '$nodename'. ".
-		"Check your network config.\n";
+	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};
+
+		die "No address from ceph cluster network (${osd_base_cidr}) found on node '$nodename'. ".
+		    "Check your network config.\n";
+	    }
 	}
 
 	# FIXME: rename params on next API compatibillity change (7.0)
-- 
2.20.1




More information about the pve-devel mailing list