3 # Copyright (C) 2013 Inktank <info@inktank.com>
4 # Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
6 # Author: Loic Dachary <loic@dachary.org>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU Library Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Library Public License for more details.
19 test -d dev/osd0/. && test -e dev/sudo && SUDO="sudo"
21 if [ -e CMakeCache.txt ]; then
22 [ -z "$CEPH_BIN" ] && CEPH_BIN=bin
29 pg=`pgrep -u $MYUID -f ceph-run.*$1`
30 [ -n "$pg" ] && kill $pg
31 $SUDO killall -u $MYNAME $1
34 usage="usage: $0 [all] [mon] [mds] [osd] [rgw]\n"
43 while [ $# -ge 1 ]; do
75 if [ $stop_all -eq 1 ]; then
76 if "${CEPH_BIN}"/rbd showmapped >/dev/null 2>&1; then
77 "${CEPH_BIN}"/rbd showmapped | tail -n +2 |
79 # While it is currently possible to create an rbd image with
80 # whitespace chars in its name, krbd will refuse mapping such
81 # an image, so we can safely split on whitespace here. (The
82 # same goes for whitespace chars in names of the pools that
83 # contain rbd images).
84 DEV="$(echo "${DEV}" | tr -s '[:space:]' | awk '{ print $5 }')"
85 sudo "${CEPH_BIN}"/rbd unmap "${DEV}"
88 if [ -n "$("${CEPH_BIN}"/rbd showmapped)" ]; then
89 echo "WARNING: Some rbd images are still mapped!" >&2
93 for p in ceph-mon ceph-mds ceph-osd ceph-mgr radosgw lt-radosgw apache2 ; do
94 for try in 0 1 1 1 1 ; do
95 if ! pkill -u $MYUID $p ; then
102 pkill -u $MYUID -f valgrind.bin.\*ceph-mon
103 $SUDO pkill -u $MYUID -f valgrind.bin.\*ceph-osd
104 pkill -u $MYUID -f valgrind.bin.\*ceph-mds
105 asok_dir=`dirname $("${CEPH_BIN}"/ceph-conf --show-config-value admin_socket)`
108 [ $stop_mon -eq 1 ] && do_killall ceph-mon
109 [ $stop_mds -eq 1 ] && do_killall ceph-mds
110 [ $stop_osd -eq 1 ] && do_killall ceph-osd
111 [ $stop_mgr -eq 1 ] && do_killall ceph-mgr
112 [ $stop_rgw -eq 1 ] && do_killall radosgw lt-radosgw apache2