From 8eb9a34ddd352d364bd7e4654f6e80b63e88d7a7 Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Mon, 13 Jul 2015 15:05:50 +0100 Subject: [PATCH] tools: ceph-monstore-update-crush: fail early if mon's running Signed-off-by: Joao Eduardo Luis --- src/tools/ceph-monstore-update-crush.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/tools/ceph-monstore-update-crush.sh b/src/tools/ceph-monstore-update-crush.sh index 3f24a08364320..dc6a6d724a50e 100755 --- a/src/tools/ceph-monstore-update-crush.sh +++ b/src/tools/ceph-monstore-update-crush.sh @@ -35,7 +35,8 @@ function osdmap_get() { local osdmap=`mktemp` ceph-monstore-tool $store_path get osdmap -- \ - $epoch -o $osdmap > /dev/null + $epoch -o $osdmap > /dev/null || return + echo $(osdmaptool --dump xml $osdmap 2> /dev/null | \ $XMLSTARLET sel -t -m "$query" -v .) @@ -73,6 +74,12 @@ function get_crush() { osdmaptool --export-crush $crush $osdmap_path 2>&1 > /dev/null } +function die() { + local retval=$? + echo "$@" >&2 + exit $retval +} + function usage() { [ $# -gt 0 ] && echo -e "\n$@" cat <