[pve-devel] applied: [PATCH manager 2/3] Fix: ceph: mon_address not considered by new MON

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Apr 15 10:30:36 CEST 2020


On March 11, 2020 4:22 pm, Alwin Antreich wrote:
> 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 at proxmox.com>
> ---
>  PVE/API2/Ceph/MON.pm | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/PVE/API2/Ceph/MON.pm b/PVE/API2/Ceph/MON.pm
> index 18b563c9..3baeac52 100644
> --- a/PVE/API2/Ceph/MON.pm
> +++ b/PVE/API2/Ceph/MON.pm
> @@ -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);
>  
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 




More information about the pve-devel mailing list