Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / qa / mon / bootstrap / simple_expand.sh
1 #!/bin/sh -ex
2
3 cwd=`pwd`
4 cat > conf <<EOF
5 [mon]
6 admin socket = 
7 log file = $cwd/\$name.log
8 debug mon = 20
9 debug ms = 1
10 EOF
11
12 rm -f mm
13 monmaptool --create mm \
14     --add a 127.0.0.1:6789 \
15     --add b 127.0.0.1:6790 \
16     --add c 127.0.0.1:6791
17
18 rm -f keyring
19 ceph-authtool --create-keyring keyring --gen-key -n client.admin
20 ceph-authtool keyring --gen-key -n mon.
21
22 ceph-mon -c conf -i a --mkfs --monmap mm --mon-data $cwd/mon.a -k keyring
23 ceph-mon -c conf -i b --mkfs --monmap mm --mon-data $cwd/mon.b -k keyring
24 ceph-mon -c conf -i c --mkfs --monmap mm --mon-data $cwd/mon.c -k keyring
25
26 ceph-mon -c conf -i a --mon-data $cwd/mon.a
27 ceph-mon -c conf -i c --mon-data $cwd/mon.b
28 ceph-mon -c conf -i b --mon-data $cwd/mon.c
29
30 ceph -c conf -k keyring --monmap mm health
31
32 ## expand via a kludged monmap
33 monmaptool mm --add d 127.0.0.1:6792
34 ceph-mon -c conf -i d --mkfs --monmap mm --mon-data $cwd/mon.d -k keyring
35 ceph-mon -c conf -i d --mon-data $cwd/mon.d
36
37 while true; do
38     ceph -c conf -k keyring --monmap mm health
39     if ceph -c conf -k keyring --monmap mm mon stat | grep 'quorum 0,1,2,3'; then
40         break
41     fi
42     sleep 1
43 done
44
45 # again
46 monmaptool mm --add e 127.0.0.1:6793
47 ceph-mon -c conf -i e --mkfs --monmap mm --mon-data $cwd/mon.e -k keyring
48 ceph-mon -c conf -i e --mon-data $cwd/mon.e
49
50 while true; do
51     ceph -c conf -k keyring --monmap mm health
52     if ceph -c conf -k keyring --monmap mm mon stat | grep 'quorum 0,1,2,3,4'; then
53         break
54     fi
55     sleep 1
56 done
57
58
59 killall ceph-mon
60 echo OK