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