From 743b15b412478e5c332e052cb94615270de87251 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 25 Aug 2015 12:32:22 -0400 Subject: [PATCH] debian: /var/run/ceph should be owned by ceph:ceph Fix upstart and sysvinit scripts to create /var/run/ceph properly. Chown existing dir on upgrade. Signed-off-by: Sage Weil --- debian/ceph-common.postinst | 7 +++++++ src/init-ceph.in | 5 ++++- src/upstart/ceph-mds.conf | 2 +- src/upstart/ceph-mon.conf | 2 +- src/upstart/ceph-osd.conf | 2 +- src/upstart/radosgw.conf | 2 +- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/debian/ceph-common.postinst b/debian/ceph-common.postinst index 647693417593b..36410a3b630b6 100644 --- a/debian/ceph-common.postinst +++ b/debian/ceph-common.postinst @@ -78,6 +78,13 @@ case "$1" in chmod u=rwx,g=rwxs,o=t /var/log/ceph fi + # 6. fix /var/run/ceph + if [ -d /var/run/ceph ]; then + echo -n "Fixing /var/run/ceph ownership.." + chown $SERVER_USER:$SERVER_GROUP /var/run/ceph + echo "..done" + fi + ;; abort-upgrade|abort-remove|abort-deconfigure) : diff --git a/src/init-ceph.in b/src/init-ceph.in index acb57d4a9594b..3e3b3a44cd5d3 100755 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -376,7 +376,10 @@ for name in $what; do fi echo Starting Ceph $name on $host... - mkdir -p $run_dir + if [ ! -d $run_dir ]; then + # assume /var/run exists + install -d -m0755 -o ceph -g ceph /var/run/ceph + fi get_conf pre_start_eval "" "pre start eval" [ -n "$pre_start_eval" ] && $pre_start_eval get_conf pre_start "" "pre start command" diff --git a/src/upstart/ceph-mds.conf b/src/upstart/ceph-mds.conf index a392aaee6e16c..5c74fc16b2e0f 100644 --- a/src/upstart/ceph-mds.conf +++ b/src/upstart/ceph-mds.conf @@ -13,7 +13,7 @@ pre-start script test -x /usr/bin/ceph-mds || { stop; exit 0; } test -d "/var/lib/ceph/mds/${cluster:-ceph}-$id" || { stop; exit 0; } - install -d -m0755 /var/run/ceph + install -d -m0755 -o ceph -g ceph /var/run/ceph end script instance ${cluster:-ceph}/$id diff --git a/src/upstart/ceph-mon.conf b/src/upstart/ceph-mon.conf index c266f6cc9f1ef..be4e0efad60f7 100644 --- a/src/upstart/ceph-mon.conf +++ b/src/upstart/ceph-mon.conf @@ -13,7 +13,7 @@ pre-start script test -x /usr/bin/ceph-mon || { stop; exit 0; } test -d "/var/lib/ceph/mon/${cluster:-ceph}-$id" || { stop; exit 0; } - install -d -m0755 /var/run/ceph + install -d -m0755 -o ceph -g ceph /var/run/ceph end script instance ${cluster:-ceph}/$id diff --git a/src/upstart/ceph-osd.conf b/src/upstart/ceph-osd.conf index f02f46571a055..a508b4126274c 100644 --- a/src/upstart/ceph-osd.conf +++ b/src/upstart/ceph-osd.conf @@ -13,7 +13,7 @@ pre-start script test -x /usr/bin/ceph-osd || { stop; exit 0; } test -d "/var/lib/ceph/osd/${cluster:-ceph}-$id" || { stop; exit 0; } - install -d -m0755 /var/run/ceph + install -d -m0755 -o ceph -g ceph /var/run/ceph /usr/libexec/ceph/ceph-osd-prestart.sh --cluster="${cluster:-ceph}" -i "$id" end script diff --git a/src/upstart/radosgw.conf b/src/upstart/radosgw.conf index fdc438006a93a..4cb6b5d08db25 100644 --- a/src/upstart/radosgw.conf +++ b/src/upstart/radosgw.conf @@ -13,7 +13,7 @@ pre-start script test -x /usr/bin/radosgw || { stop; exit 0; } test -d "/var/lib/ceph/radosgw/${cluster:-ceph}-$id" || { stop; exit 0; } - install -d -m0755 /var/run/ceph + install -d -m0755 -o ceph -g ceph /var/run/ceph end script instance ${cluster:-ceph}/$id -- 2.47.3