Add check if ceph is managed by systemd

Ceph is managed since version infernalis by systemd and use
ceph as user and group.
This commit is contained in:
Wolfgang Link 2016-06-07 13:24:05 +02:00 committed by Dietmar Maurer
parent 93363a1128
commit 1aecf972bc

View File

@ -193,7 +193,7 @@ sub setup_pve_symlinks {
sub ceph_service_cmd {
my ($action, $service) = @_;
if(-f "/lib/systemd/system/ceph-osd@.service") {
if (systemd_managed()) {
if ($service && $service =~ m/^(mon|osd|mds|radosgw)(\.([A-Za-z0-9]{1,32}))?$/) {
$service = defined($3) ? "ceph-$1\@$3" : "ceph-$1.target";
@ -353,4 +353,15 @@ sub list_disks {
return $disklist;
}
# Ceph versions greater Hammer use 'ceph' as user and group instead
# of 'root', and use systemd.
sub systemd_managed {
if (-f "/lib/systemd/system/ceph-osd\@.service") {
return 1;
} else {
return 0;
}
}
1;