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