From 87c98e92d1375c8bc76196bbbf06f677bef95e64 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 2 Jul 2013 14:43:17 -0700 Subject: [PATCH] sysvinit, upstart: handle symlinks to dirs in /var/lib/ceph/* Match a symlink to a dir, not just dirs. This fixes the osd case of e.g., creating an osd in /data/osd$id in which ceph-disk makes a symlink from /var/lib/ceph/osd/ceph-$id. Fix proposed by Matt Thompson ; extended to include the upstart users too. Fixes: #5490 Signed-off-by: Sage Weil Reviewed-by: Dan Mick --- src/ceph_common.sh | 2 +- src/upstart/ceph-mds-all-starter.conf | 2 +- src/upstart/ceph-mon-all-starter.conf | 2 +- src/upstart/ceph-osd-all-starter.conf | 2 +- src/upstart/radosgw-all-starter.conf | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ceph_common.sh b/src/ceph_common.sh index 48354e41bfe06..cedda4fb6c03f 100644 --- a/src/ceph_common.sh +++ b/src/ceph_common.sh @@ -136,7 +136,7 @@ do_root_cmd() { get_local_daemon_list() { type=$1 if [ -d "/var/lib/ceph/$type" ]; then - for i in `find /var/lib/ceph/$type -mindepth 1 -maxdepth 1 -type d -printf '%f\n'`; do + for i in `find -L /var/lib/ceph/$type -mindepth 1 -maxdepth 1 -type d -printf '%f\n'`; do if [ -e "/var/lib/ceph/$type/$i/sysvinit" ]; then id=`echo $i | sed 's/[^-]*-//'` local="$local $type.$id" diff --git a/src/upstart/ceph-mds-all-starter.conf b/src/upstart/ceph-mds-all-starter.conf index e7fbf855ad41e..fa18b25e87c3b 100644 --- a/src/upstart/ceph-mds-all-starter.conf +++ b/src/upstart/ceph-mds-all-starter.conf @@ -7,7 +7,7 @@ task script set -e # TODO what's the valid charset for cluster names and mds ids? - find /var/lib/ceph/mds/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ + find -L /var/lib/ceph/mds/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ | while read f; do if [ -e "/var/lib/ceph/mds/$f/done" ] && [ -e "/var/lib/ceph/mds/$f/upstart" ]; then cluster="${f%%-*}" diff --git a/src/upstart/ceph-mon-all-starter.conf b/src/upstart/ceph-mon-all-starter.conf index 9f5574f5baa51..b9664b62fedef 100644 --- a/src/upstart/ceph-mon-all-starter.conf +++ b/src/upstart/ceph-mon-all-starter.conf @@ -7,7 +7,7 @@ task script set -e # TODO what's the valid charset for cluster names and mon ids? - find /var/lib/ceph/mon/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ + find -L /var/lib/ceph/mon/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ | while read f; do if [ -e "/var/lib/ceph/mon/$f/done" ] && [ -e "/var/lib/ceph/mon/$f/upstart" ]; then cluster="${f%%-*}" diff --git a/src/upstart/ceph-osd-all-starter.conf b/src/upstart/ceph-osd-all-starter.conf index eeb64bca567f7..2e36dcceca63b 100644 --- a/src/upstart/ceph-osd-all-starter.conf +++ b/src/upstart/ceph-osd-all-starter.conf @@ -11,7 +11,7 @@ script ceph-disk activate-all # TODO what's the valid charset for cluster names and osd ids? - find /var/lib/ceph/osd/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ + find -L /var/lib/ceph/osd/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ | while read f; do if [ -e "/var/lib/ceph/osd/$f/ready" ] && [ -e "/var/lib/ceph/osd/$f/upstart" ]; then cluster="${f%%-*}" diff --git a/src/upstart/radosgw-all-starter.conf b/src/upstart/radosgw-all-starter.conf index 15bbce28b238e..8ab3c0d90293b 100644 --- a/src/upstart/radosgw-all-starter.conf +++ b/src/upstart/radosgw-all-starter.conf @@ -7,7 +7,7 @@ task script set -e # TODO what's the valid charset for cluster names and daemon ids? - find /var/lib/ceph/radosgw/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ + find -L /var/lib/ceph/radosgw/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ | while read f; do if [ -e "/var/lib/ceph/radosgw/$f/done" ]; then cluster="${f%%-*}" -- 2.39.5