[pve-devel] [PATCH V2 pve-manager 2/2] Mask the SysV scripts and enable our systemd service.
Wolfgang Link
w.link at proxmox.com
Tue Dec 20 07:55:47 CET 2016
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
---
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 $@;
+
+ #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 $@;
+ }
+
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 $@;
+ }
};
return $rpcenv->fork_worker('cephcreatemon', $monsection, $authuser, $worker);
--
2.1.4
More information about the pve-devel
mailing list