Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / qa / mon / bootstrap / simple_single_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
16 rm -f keyring
17 ceph-authtool --create-keyring keyring --gen-key -n client.admin
18 ceph-authtool keyring --gen-key -n mon.
19
20 ceph-mon -c conf -i a --mkfs --monmap mm --mon-data $cwd/mon.a -k keyring
21
22 ceph-mon -c conf -i a --mon-data $cwd/mon.a
23
24 ceph -c conf -k keyring --monmap mm health
25
26 ## expand via a kludged monmap
27 monmaptool mm --add d 127.0.0.1:6702
28 ceph-mon -c conf -i d --mkfs --monmap mm --mon-data $cwd/mon.d -k keyring
29 ceph-mon -c conf -i d --mon-data $cwd/mon.d
30
31 while true; do
32     ceph -c conf -k keyring --monmap mm health
33     if ceph -c conf -k keyring --monmap mm mon stat | grep 'quorum 0,1'; then
34         break
35     fi
36     sleep 1
37 done
38
39 # again
40 monmaptool mm --add e 127.0.0.1:6793
41 ceph-mon -c conf -i e --mkfs --monmap mm --mon-data $cwd/mon.e -k keyring
42 ceph-mon -c conf -i e --mon-data $cwd/mon.e
43
44 while true; do
45     ceph -c conf -k keyring --monmap mm health
46     if ceph -c conf -k keyring --monmap mm mon stat | grep 'quorum 0,1,2'; then
47         break
48     fi
49     sleep 1
50 done
51
52
53 killall ceph-mon
54 echo OK