ceph: mon create: fix not starting monitor if no public_addr is in conf

when there is no 'public_network' in the config, the monitor
can only find an ip if it is given explicitly, either via commandline
(not possible with systemd) or via the ceph.conf

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2019-06-28 13:22:27 +02:00 committed by Thomas Lamprecht
parent 696a8cac2d
commit 78f99813bb

View File

@ -265,6 +265,11 @@ __PACKAGE__->register_method ({
my $monhost = $cfg->{global}->{mon_host} // ""; my $monhost = $cfg->{global}->{mon_host} // "";
$monhost .= " $ip"; $monhost .= " $ip";
$cfg->{global}->{mon_host} = $monhost; $cfg->{global}->{mon_host} = $monhost;
if (!defined($cfg->{global}->{public_network})) {
# if there is no info about the public_network
# we have to set it explicitely for the monitor
$cfg->{$monsection}->{public_addr} = $ip;
}
cfs_write_file('ceph.conf', $cfg); cfs_write_file('ceph.conf', $cfg);