[pve-devel] [PATCH] cephserver : add systemd support
Alexandre Derumier
aderumier at odiso.com
Mon May 16 17:41:49 CEST 2016
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/CephTools.pm | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/PVE/CephTools.pm b/PVE/CephTools.pm
index ec91f44..25a7798 100644
--- a/PVE/CephTools.pm
+++ b/PVE/CephTools.pm
@@ -191,9 +191,19 @@ sub setup_pve_symlinks {
}
sub ceph_service_cmd {
- # ceph daemons does not call 'setsid', so we do that ourself
- # (fork_worker send KILL to whole process group)
- PVE::Tools::run_command(['setsid', 'service', 'ceph', '-c', $pve_ceph_cfgpath, @_]);
+ my ($action, $service) = @_;
+
+ if(-f "/lib/systemd/system/ceph-osd at .service") {
+ if ($service =~ m/^(\S+)\.(\d+)$/) {
+ $service = "ceph-$1@$2";
+ PVE::Tools::run_command(['setsid', '/bin/systemctl', $action, $service]);
+ }
+
+ } else {
+ # ceph daemons does not call 'setsid', so we do that ourself
+ # (fork_worker send KILL to whole process group)
+ PVE::Tools::run_command(['setsid', 'service', 'ceph', '-c', $pve_ceph_cfgpath, $action, $service]);
+ }
}
sub list_disks {
--
2.1.4
More information about the pve-devel
mailing list