summaryrefslogtreecommitdiffstats
path: root/qa/mon
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-05-17 23:50:31 +0200
committerSage Weil <sage@inktank.com>2012-05-19 01:23:57 +0200
commit0b74b8f6a6a90558337edc592f6564251edff754 (patch)
tree142115e868f55a57549c30a044d92e838a864976 /qa/mon
parentmon: ignore election messages from outside monmap (diff)
downloadceph-0b74b8f6a6a90558337edc592f6564251edff754.tar.xz
ceph-0b74b8f6a6a90558337edc592f6564251edff754.zip
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>
Diffstat (limited to 'qa/mon')
-rwxr-xr-xqa/mon/bootstrap/host.sh29
-rwxr-xr-xqa/mon/bootstrap/initial_members.sh39
-rwxr-xr-xqa/mon/bootstrap/simple.sh35
-rwxr-xr-xqa/mon/bootstrap/simple_expand.sh60
-rwxr-xr-xqa/mon/bootstrap/simple_expand_monmap.sh43
-rwxr-xr-xqa/mon/bootstrap/simple_single_expand.sh54
-rwxr-xr-xqa/mon/bootstrap/simple_single_expand2.sh40
-rwxr-xr-xqa/mon/bootstrap/single_host.sh29
-rwxr-xr-xqa/mon/bootstrap/single_host_multi.sh39
9 files changed, 368 insertions, 0 deletions
diff --git a/qa/mon/bootstrap/host.sh b/qa/mon/bootstrap/host.sh
new file mode 100755
index 00000000000..1f7a01c377c
--- /dev/null
+++ b/qa/mon/bootstrap/host.sh
@@ -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 \ No newline at end of file
diff --git a/qa/mon/bootstrap/initial_members.sh b/qa/mon/bootstrap/initial_members.sh
new file mode 100755
index 00000000000..0880df35835
--- /dev/null
+++ b/qa/mon/bootstrap/initial_members.sh
@@ -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
diff --git a/qa/mon/bootstrap/simple.sh b/qa/mon/bootstrap/simple.sh
new file mode 100755
index 00000000000..32dfc6a6c98
--- /dev/null
+++ b/qa/mon/bootstrap/simple.sh
@@ -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
diff --git a/qa/mon/bootstrap/simple_expand.sh b/qa/mon/bootstrap/simple_expand.sh
new file mode 100755
index 00000000000..cf2b8794f74
--- /dev/null
+++ b/qa/mon/bootstrap/simple_expand.sh
@@ -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
diff --git a/qa/mon/bootstrap/simple_expand_monmap.sh b/qa/mon/bootstrap/simple_expand_monmap.sh
new file mode 100755
index 00000000000..c79959174d1
--- /dev/null
+++ b/qa/mon/bootstrap/simple_expand_monmap.sh
@@ -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
diff --git a/qa/mon/bootstrap/simple_single_expand.sh b/qa/mon/bootstrap/simple_single_expand.sh
new file mode 100755
index 00000000000..791f1288d53
--- /dev/null
+++ b/qa/mon/bootstrap/simple_single_expand.sh
@@ -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
diff --git a/qa/mon/bootstrap/simple_single_expand2.sh b/qa/mon/bootstrap/simple_single_expand2.sh
new file mode 100755
index 00000000000..ff95abe3eb3
--- /dev/null
+++ b/qa/mon/bootstrap/simple_single_expand2.sh
@@ -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
diff --git a/qa/mon/bootstrap/single_host.sh b/qa/mon/bootstrap/single_host.sh
new file mode 100755
index 00000000000..1f7a01c377c
--- /dev/null
+++ b/qa/mon/bootstrap/single_host.sh
@@ -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 \ No newline at end of file
diff --git a/qa/mon/bootstrap/single_host_multi.sh b/qa/mon/bootstrap/single_host_multi.sh
new file mode 100755
index 00000000000..ad3377511e4
--- /dev/null
+++ b/qa/mon/bootstrap/single_host_multi.sh
@@ -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 \ No newline at end of file