Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / qa / standalone / osd / osd-reactivate.sh
1 #!/bin/bash
2 #
3 # Author: Vicente Cheng <freeze.bilsted@gmail.com>
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU Library Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU Library Public License for more details.
14 #
15
16 source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
17
18 function run() {
19     local dir=$1
20     shift
21
22     export CEPH_MON="127.0.0.1:7122" # git grep '\<7122\>' : there must be only one
23     export CEPH_ARGS
24     CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
25     CEPH_ARGS+="--mon-host=$CEPH_MON "
26
27     local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
28     for func in $funcs ; do
29         setup $dir || return 1
30         $func $dir || return 1
31         teardown $dir || return 1
32     done
33 }
34
35 function TEST_reactivate() {
36     local dir=$1
37
38     run_mon $dir a || return 1
39     run_mgr $dir x || return 1
40     run_osd $dir 0 || return 1
41
42     kill_daemons $dir TERM osd || return 1
43
44     ready_path=$dir"/0/ready"
45     activate_path=$dir"/0/active"
46     # trigger mkfs again
47     rm -rf $ready_path $activate_path
48     activate_osd $dir 0 || return 1
49
50 }
51
52 main osd-reactivate "$@"
53
54 # Local Variables:
55 # compile-command: "cd ../.. ; make -j4 && test/osd/osd-reactivate.sh"
56 # End: