api: ceph: create mon: explicitly add subsequent monitors to the monmap

in preparation for supporting multiple addresses. The config section does not
allow more than one public_addr.

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2021-05-10 14:18:20 +02:00 committed by Thomas Lamprecht
parent 57951fc78b
commit 8ecaa0bfbe

View File

@ -272,7 +272,6 @@ __PACKAGE__->register_method ({
my $monmaptool_cmd = [ my $monmaptool_cmd = [
'monmaptool', 'monmaptool',
'--create',
'--clobber', '--clobber',
'--addv', '--addv',
$monid, $monid,
@ -284,7 +283,9 @@ __PACKAGE__->register_method ({
if (defined($rados)) { # we can only have a RADOS object if we have a monitor if (defined($rados)) { # we can only have a RADOS object if we have a monitor
my $mapdata = $rados->mon_command({ prefix => 'mon getmap', format => 'plain' }); my $mapdata = $rados->mon_command({ prefix => 'mon getmap', format => 'plain' });
file_set_contents($monmap, $mapdata); file_set_contents($monmap, $mapdata);
run_command($monmaptool_cmd);
} else { # we need to create a monmap for the first monitor } else { # we need to create a monmap for the first monitor
push @{$monmaptool_cmd}, '--create';
run_command($monmaptool_cmd); run_command($monmaptool_cmd);
} }