qa: add a bunch of mon bootstrap tests

These's are comprehensive because a lot of the startup logic is about
picking a local address, and it's difficult to do test that on a single
host.  They cover the other variables surrounding mon bringing up, though:

 - part of initial monmap, or not
 - new nodes given all prior nodes, or not
 - new nodes have self included in monmap seed, or not
 - initial quorum members

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2012-05-17 14:50:31 -07:00
parent cba3ca7b8d
commit 0b74b8f6a6
9 changed files with 368 additions and 0 deletions

29
qa/mon/bootstrap/host.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh -ex
cwd=`pwd`
cat > conf <<EOF
[global]
mon host = 127.0.0.1:6789
[mon]
admin socket =
log file = $cwd/\$name.log
debug mon = 20
debug ms = 1
EOF
rm -f mm
fsid=`uuidgen`
rm -f keyring
ceph-authtool --create-keyring keyring --gen-key -n client.admin
ceph-authtool keyring --gen-key -n mon.
ceph-mon -c conf -i a --mkfs --fsid $fsid --mon-data mon.a -k keyring
ceph-mon -c conf -i a --mon-data mon.a
ceph -c conf -k keyring health
killall ceph-mon
echo OK

View File

@ -0,0 +1,39 @@
#!/bin/sh -ex
cwd=`pwd`
cat > conf <<EOF
[mon]
admin socket =
log file = $cwd/\$name.log
debug mon = 20
debug ms = 1
mon initial members = a,b,d
EOF
rm -f mm
monmaptool --create mm \
--add a 127.0.0.1:6789 \
--add b 127.0.0.1:6790 \
--add c 127.0.0.1:6791
rm -f keyring
ceph-authtool --create-keyring keyring --gen-key -n client.admin
ceph-authtool keyring --gen-key -n mon.
ceph-mon -c conf -i a --mkfs --monmap mm --mon-data mon.a -k keyring
ceph-mon -c conf -i b --mkfs --monmap mm --mon-data mon.b -k keyring
ceph-mon -c conf -i c --mkfs --monmap mm --mon-data mon.c -k keyring
ceph-mon -c conf -i a --mon-data mon.a
ceph-mon -c conf -i c --mon-data mon.b
ceph-mon -c conf -i b --mon-data mon.c
ceph -c conf -k keyring --monmap mm health
ceph -c conf -k keyring --monmap mm health
if ceph -c conf -k keyring --monmap mm mon stat | grep a= | grep b= | grep c= ; then
break
fi
killall ceph-mon
echo OK

35
qa/mon/bootstrap/simple.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh -e
cat > conf <<EOF
[mon]
admin socket =
EOF
rm -f mm
monmaptool --create mm \
--add a 127.0.0.1:6789 \
--add b 127.0.0.1:6790 \
--add c 127.0.0.1:6791
rm -f keyring
ceph-authtool --create-keyring keyring --gen-key -n client.admin
ceph-authtool keyring --gen-key -n mon.
ceph-mon -c conf -i a --mkfs --monmap mm --mon-data mon.a -k keyring
ceph-mon -c conf -i b --mkfs --monmap mm --mon-data mon.b -k keyring
ceph-mon -c conf -i c --mkfs --monmap mm --mon-data mon.c -k keyring
ceph-mon -c conf -i a --mon-data mon.a
ceph-mon -c conf -i c --mon-data mon.b
ceph-mon -c conf -i b --mon-data mon.c
while true; do
ceph -c conf -k keyring --monmap mm health
if ceph -c conf -k keyring --monmap mm mon stat | grep 'quorum 0,1,2'; then
break
fi
sleep 1
done
killall ceph-mon
echo OK

View File

@ -0,0 +1,60 @@
#!/bin/sh -ex
cwd=`pwd`
cat > conf <<EOF
[mon]
admin socket =
log file = $cwd/\$name.log
debug mon = 20
debug ms = 1
EOF
rm -f mm
monmaptool --create mm \
--add a 127.0.0.1:6789 \
--add b 127.0.0.1:6790 \
--add c 127.0.0.1:6791
rm -f keyring
ceph-authtool --create-keyring keyring --gen-key -n client.admin
ceph-authtool keyring --gen-key -n mon.
ceph-mon -c conf -i a --mkfs --monmap mm --mon-data mon.a -k keyring
ceph-mon -c conf -i b --mkfs --monmap mm --mon-data mon.b -k keyring
ceph-mon -c conf -i c --mkfs --monmap mm --mon-data mon.c -k keyring
ceph-mon -c conf -i a --mon-data mon.a
ceph-mon -c conf -i c --mon-data mon.b
ceph-mon -c conf -i b --mon-data mon.c
ceph -c conf -k keyring --monmap mm health
## expand via a kludged monmap
monmaptool mm --add d 127.0.0.1:6792
ceph-mon -c conf -i d --mkfs --monmap mm --mon-data mon.d -k keyring
ceph-mon -c conf -i d --mon-data mon.d
while true; do
ceph -c conf -k keyring --monmap mm health
if ceph -c conf -k keyring --monmap mm mon stat | grep 'quorum 0,1,2,3'; then
break
fi
sleep 1
done
# again
monmaptool mm --add e 127.0.0.1:6793
ceph-mon -c conf -i e --mkfs --monmap mm --mon-data mon.e -k keyring
ceph-mon -c conf -i e --mon-data mon.e
while true; do
ceph -c conf -k keyring --monmap mm health
if ceph -c conf -k keyring --monmap mm mon stat | grep 'quorum 0,1,2,3,4'; then
break
fi
sleep 1
done
killall ceph-mon
echo OK

View File

@ -0,0 +1,43 @@
#!/bin/sh -ex
cat > conf <<EOF
[mon]
admin socket =
EOF
rm -f mm
monmaptool --create mm \
--add a 127.0.0.1:6789 \
--add b 127.0.0.1:6790 \
--add c 127.0.0.1:6791
rm -f keyring
ceph-authtool --create-keyring keyring --gen-key -n client.admin
ceph-authtool keyring --gen-key -n mon.
ceph-mon -c conf -i a --mkfs --monmap mm --mon-data mon.a -k keyring
ceph-mon -c conf -i b --mkfs --monmap mm --mon-data mon.b -k keyring
ceph-mon -c conf -i c --mkfs --monmap mm --mon-data mon.c -k keyring
ceph-mon -c conf -i a --mon-data mon.a
ceph-mon -c conf -i c --mon-data mon.b
ceph-mon -c conf -i b --mon-data mon.c
ceph -c conf -k keyring --monmap mm health
## expand via a kludged monmap
monmaptool mm --add d 127.0.0.1:6792
ceph-mon -c conf -i d --mkfs --monmap mm --mon-data mon.d -k keyring
ceph-mon -c conf -i d --mon-data mon.d
while true; do
ceph -c conf -k keyring --monmap mm health
if ceph -c conf -k keyring --monmap mm mon stat | grep d=; then
break
fi
sleep 1
done
killall ceph-mon
echo OK

View File

@ -0,0 +1,54 @@
#!/bin/sh -ex
cwd=`pwd`
cat > conf <<EOF
[mon]
admin socket =
log file = $cwd/\$name.log
debug mon = 20
debug ms = 1
EOF
rm -f mm
monmaptool --create mm \
--add a 127.0.0.1:6789
rm -f keyring
ceph-authtool --create-keyring keyring --gen-key -n client.admin
ceph-authtool keyring --gen-key -n mon.
ceph-mon -c conf -i a --mkfs --monmap mm --mon-data mon.a -k keyring
ceph-mon -c conf -i a --mon-data mon.a
ceph -c conf -k keyring --monmap mm health
## expand via a kludged monmap
monmaptool mm --add d 127.0.0.1:6702
ceph-mon -c conf -i d --mkfs --monmap mm --mon-data mon.d -k keyring
ceph-mon -c conf -i d --mon-data mon.d
while true; do
ceph -c conf -k keyring --monmap mm health
if ceph -c conf -k keyring --monmap mm mon stat | grep 'quorum 0,1'; then
break
fi
sleep 1
done
# again
monmaptool mm --add e 127.0.0.1:6793
ceph-mon -c conf -i e --mkfs --monmap mm --mon-data mon.e -k keyring
ceph-mon -c conf -i e --mon-data mon.e
while true; do
ceph -c conf -k keyring --monmap mm health
if ceph -c conf -k keyring --monmap mm mon stat | grep 'quorum 0,1,2'; then
break
fi
sleep 1
done
killall ceph-mon
echo OK

View File

@ -0,0 +1,40 @@
#!/bin/sh -ex
cwd=`pwd`
cat > conf <<EOF
[mon]
admin socket =
log file = $cwd/\$name.log
debug mon = 20
debug ms = 1
EOF
rm -f mm
ip=`host \`hostname\` | awk '{print $4}'`
monmaptool --create mm \
--add a $ip:6779
rm -f keyring
ceph-authtool --create-keyring keyring --gen-key -n client.admin
ceph-authtool keyring --gen-key -n mon.
ceph-mon -c conf -i a --mkfs --monmap mm --mon-data mon.a -k keyring
ceph-mon -c conf -i a --mon-data mon.a
ceph -c conf -k keyring --monmap mm health
## expand via a local_network
ceph-mon -c conf -i d --mkfs --monmap mm --mon-data mon.d -k keyring
ceph-mon -c conf -i d --mon-data mon.d --public-network 127.0.0.1/32
while true; do
ceph -c conf -k keyring --monmap mm health
if ceph -c conf -k keyring --monmap mm mon stat | grep 'quorum 0,1'; then
break
fi
sleep 1
done
killall ceph-mon
echo OK

29
qa/mon/bootstrap/single_host.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh -ex
cwd=`pwd`
cat > conf <<EOF
[global]
mon host = 127.0.0.1:6789
[mon]
admin socket =
log file = $cwd/\$name.log
debug mon = 20
debug ms = 1
EOF
rm -f mm
fsid=`uuidgen`
rm -f keyring
ceph-authtool --create-keyring keyring --gen-key -n client.admin
ceph-authtool keyring --gen-key -n mon.
ceph-mon -c conf -i a --mkfs --fsid $fsid --mon-data mon.a -k keyring
ceph-mon -c conf -i a --mon-data mon.a
ceph -c conf -k keyring health
killall ceph-mon
echo OK

View File

@ -0,0 +1,39 @@
#!/bin/sh -ex
cwd=`pwd`
cat > conf <<EOF
[global]
[mon]
admin socket =
log file = $cwd/\$name.log
debug mon = 20
debug ms = 1
mon host = 127.0.0.1:6789 127.0.0.1:6790 127.0.0.1:6791
EOF
rm -f mm
fsid=`uuidgen`
rm -f keyring
ceph-authtool --create-keyring keyring --gen-key -n client.admin
ceph-authtool keyring --gen-key -n mon.
ceph-mon -c conf -i a --mkfs --fsid $fsid --mon-data mon.a -k keyring --public-addr 127.0.0.1:6789
ceph-mon -c conf -i b --mkfs --fsid $fsid --mon-data mon.b -k keyring --public-addr 127.0.0.1:6790
ceph-mon -c conf -i c --mkfs --fsid $fsid --mon-data mon.c -k keyring --public-addr 127.0.0.1:6791
ceph-mon -c conf -i a --mon-data mon.a
ceph-mon -c conf -i b --mon-data mon.b
ceph-mon -c conf -i c --mon-data mon.c
ceph -c conf -k keyring health -m 127.0.0.1
while true; do
if ceph -c conf -k keyring -m 127.0.0.1 mon stat | grep 'quorum 0,1,2'; then
break
fi
sleep 1
done
killall ceph-mon
echo OK