[pve-devel] [PATCH] cephserver : add systemd support V2
Alexandre Derumier
aderumier at odiso.com
Tue May 17 09:44:42 CEST 2016
changelog :
- remove setsid
- use [A-Za-z0-9]{1,32} pattern for services
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/CephTools.pm | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/PVE/CephTools.pm b/PVE/CephTools.pm
index ec91f44..1eda1aa 100644
--- a/PVE/CephTools.pm
+++ b/PVE/CephTools.pm
@@ -191,9 +191,23 @@ 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 && $service =~ m/^(mon|osd|mds|radosgw)(\.([A-Za-z0-9]{1,32}))?$/) {
+ $service = $3 ? "ceph-$1\@$3" : "ceph-$1.target";
+ } else {
+ $service = "ceph.target";
+ }
+
+ PVE::Tools::run_command(['/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