From a0ef509a66a016072a58630e3463a6bbac919cfd Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 24 Feb 2020 12:01:35 +0100 Subject: [PATCH] ceph: do not check ips if no network is configured 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 --- PVE/API2/Ceph/OSD.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 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}; + 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"; + 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)