[pve-devel] [PATCH V2 pve-manager 2/2] Mask the SysV scripts and enable our systemd service.

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Dec 20 09:48:36 CET 2016


On Tue, Dec 20, 2016 at 07:55:47AM +0100, Wolfgang Link wrote:
> This is important to control the exact start-up of ceph at boot.
> We have the ceph.conf in the pmxcfs to pvecluster must startup first.
> The ceph.sevice is a link to the old SysV scrips and can end in a race-condition for the osd's

s/pmxcfs to/pmxcfs so/
s/scrips/script/

it's not really a race condition but more like it's only working because
of the init script ;) see http://tracker.ceph.com/issues/18305 for the
upstream bug

> ---
>  PVE/API2/Ceph.pm | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> Fix $monid in line 957
> 
> diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
> index 96ae9e2..ae9b480 100644
> --- a/PVE/API2/Ceph.pm
> +++ b/PVE/API2/Ceph.pm
> @@ -845,6 +845,16 @@ __PACKAGE__->register_method ({
>  
>  	my $systemd_managed = PVE::CephTools::systemd_managed();
>  
> +	if ($systemd_managed) {
> +	    #to disable old SysV init scripts.
> +	    eval { PVE::Tools::run_command(['/bin/systemctl', 'mask', 'ceph.service']); };
> +	    die "Can't mask ceph.service\n" if $@;

we don't really need to die here, do we? it works with the init script,
it's just ugly as hell.

> +
> +	    #to ensure we have the correct startup order.
> +	    eval { PVE::Tools::run_command(['/bin/systemctl', 'enable', 'pve-ceph-disk.service']); };
> +	    warn "Enable pve-ceph-disk.service manualy"if $@;

s/manualy/manually/

> +	}
> +
>  	foreach my $section (keys %$cfg) {
>  	    next if $section eq 'global';
>  	    my $d = $cfg->{$section};
> @@ -941,6 +951,12 @@ __PACKAGE__->register_method ({
>  	    PVE::CephTools::write_ceph_config($cfg);
>  
>  	    PVE::CephTools::ceph_service_cmd('start', $monsection);
> +
> +	    if ($systemd_managed) {
> +		#to ensure we have the correct startup order.
> +		eval { PVE::Tools::run_command(['/bin/systemctl', 'enable', "ceph-mon\@${monid}.service"]); };
> +		warn "Enable ceph-mon@$monid.service manualy"if $@;
s/manualy/manually/
> +	    }
>  	};
>  
>  	return $rpcenv->fork_worker('cephcreatemon', $monsection, $authuser, $worker);
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list