From: Sage Weil Date: Mon, 2 Mar 2009 17:51:13 +0000 (-0800) Subject: initscripts: ensure cluster.conf exists X-Git-Tag: v0.7~81^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=67bf2bf9b2ddba131dca1999fe950dcf8fa0e89a;p=ceph.git initscripts: ensure cluster.conf exists --- diff --git a/src/ceph-daemons b/src/ceph-daemons index c0830ce57ca..8d24cfca308 100755 --- a/src/ceph-daemons +++ b/src/ceph-daemons @@ -13,8 +13,6 @@ else ETCDIR=/etc/ceph fi -. $LIBDIR/ceph_common.sh - usage_exit() { echo "usage: $0 [options] {start|stop|restart} [mon|osd|mds]..." printf "\t-c conffile.conf\n" @@ -22,6 +20,9 @@ usage_exit() { exit } +. $LIBDIR/ceph_common.sh + + stop_daemon() { name=$1 daemon=$2 @@ -93,7 +94,6 @@ options="$options $1" shift done - # build mon_addr_arg with all mon addrs n=0 mon_addr_arg="" @@ -115,9 +115,9 @@ for name in $what; do type=`echo $name | cut -c 1-3` # e.g. 'mon', if $item is 'mon1' num=`echo $name | cut -c 4-` sections="$name $type global" - +echo $name check_host || continue - +echo $name get_conf pid_file "/var/run/ceph/$name.pid" "pid file" $sections get_conf conf_file "$runtime_conf" "conf file" $sections @@ -172,6 +172,11 @@ for name in $what; do $0 $options stop $name $0 $options start $name ;; + + cleanlogs) + get_conf log_dir "/var/log/ceph" "log dir" $sections + do_cmd "for f in $log_dir/$name*; do rm `readlink $f` ; rm $f ; done" + ;; *) usage_exit diff --git a/src/ceph_common.sh b/src/ceph_common.sh index 58e517b3f04..edbe1189e6e 100644 --- a/src/ceph_common.sh +++ b/src/ceph_common.sh @@ -7,6 +7,13 @@ runtime_conf=$ETCDIR"/ceph.conf" hostname=`hostname | cut -d . -f 1` +# make sure cluster.conf exists +if [ ! -e $conf ]; then + echo "$0: Cluster conf $conf not found" + usage_exit +fi + + check_host() { # what host is this daemon assigned to? host=`$CCONF -c $conf -s $name -s $type host` diff --git a/src/cosd.conf b/src/cosd.conf index 38c76de54ad..52fc1c9c03d 100644 --- a/src/cosd.conf +++ b/src/cosd.conf @@ -5,6 +5,7 @@ [mon] [mon0] + host = cosd0 mon addr = 10.3.14.95:6789 mon data = /home/sage/ceph/src/mondata/mon$num @@ -32,4 +33,5 @@ osd data = devm/osd17 btrfs devs = /dev/disk/by-path/pci-0000:05:01.0-scsi-3:0:0:0 -[mds0] \ No newline at end of file +[mds0] + host = cosd0 \ No newline at end of file diff --git a/src/mkcephfs b/src/mkcephfs index bc4aaf84f70..2da42814d36 100755 --- a/src/mkcephfs +++ b/src/mkcephfs @@ -12,13 +12,14 @@ else ETCDIR=/etc/ceph fi -. $LIBDIR/ceph_common.sh - usage_exit() { echo "usage: $0 [--allhosts] [-c conffile.conf] [--clobber_old_data] [--mkbtrfs]" exit } +. $LIBDIR/ceph_common.sh + + allhosts=0 clobber="" mkbtrfs=0