]> git.proxmox.com Git - pve-manager.git/commitdiff
Fix: ceph: mon_address not considered by new MON
authorAlwin Antreich <a.antreich@proxmox.com>
Wed, 11 Mar 2020 15:22:36 +0000 (16:22 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 15 Apr 2020 07:52:31 +0000 (09:52 +0200)
The public_addr option for creating a new MON is only valid for manual
startup (since Ceph Jewel) and is just ignored by ceph-mon during setup.
As the MON is started after the creation through systemd without an IP
specified. It is trying to auto-select an IP.

Before this patch the public_addr was only explicitly written to the
ceph.conf if no public_network was set. The mon_address is only needed
in the config on the first start of the MON.

The ceph-mon itself tries to select an IP on the following conditions.
- no public_network or public_addr is in the ceph.conf
    * startup fails

- public_network is in the ceph.conf
    * with a single network, take the first available IP
    * on multiple networks, walk through the list orderly and start on
      the first network where an IP is found

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
PVE/API2/Ceph/MON.pm

index 18b563c98a64b8dbffd556c08d4f9561eb5d7785..3baeac525336a151282b25e689aa267dbb0fc0c4 100644 (file)
@@ -255,7 +255,7 @@ __PACKAGE__->register_method ({
                        run_command("monmaptool --create --clobber --addv $monid '[v2:$monaddr:3300,v1:$monaddr:6789]' --print $monmap");
                    }
 
-                   run_command("ceph-mon --mkfs -i $monid --monmap $monmap --keyring $mon_keyring --public-addr $ip");
+                   run_command("ceph-mon --mkfs -i $monid --monmap $monmap --keyring $mon_keyring");
                    run_command("chown ceph:ceph -R $mondir");
                };
                my $err = $@;
@@ -275,11 +275,8 @@ __PACKAGE__->register_method ({
                }
                $monhost .= " $ip";
                $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 explicitly for the monitor
-                   $cfg->{$monsection}->{public_addr} = $ip;
-               }
+               # The IP is needed in the ceph.conf for the first boot
+               $cfg->{$monsection}->{public_addr} = $ip;
 
                cfs_write_file('ceph.conf', $cfg);