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 <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-02-24 12:01:35 +01:00 committed by Thomas Lamprecht
parent 5ae4718fbe
commit a0ef509a66

View File

@ -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)