]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: add a bunch of mon bootstrap tests
authorSage Weil <sage@inktank.com>
Thu, 17 May 2012 21:50:31 +0000 (14:50 -0700)
committerSage Weil <sage@inktank.com>
Fri, 18 May 2012 23:23:57 +0000 (16:23 -0700)
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>
qa/mon/bootstrap/host.sh [new file with mode: 0755]
qa/mon/bootstrap/initial_members.sh [new file with mode: 0755]
qa/mon/bootstrap/simple.sh [new file with mode: 0755]
qa/mon/bootstrap/simple_expand.sh [new file with mode: 0755]
qa/mon/bootstrap/simple_expand_monmap.sh [new file with mode: 0755]
qa/mon/bootstrap/simple_single_expand.sh [new file with mode: 0755]
qa/mon/bootstrap/simple_single_expand2.sh [new file with mode: 0755]
qa/mon/bootstrap/single_host.sh [new file with mode: 0755]
qa/mon/bootstrap/single_host_multi.sh [new file with mode: 0755]

diff --git a/qa/mon/bootstrap/host.sh b/qa/mon/bootstrap/host.sh
new file mode 100755 (executable)
index 0000000..1f7a01c
--- /dev/null
@@ -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 (executable)
index 0000000..0880df3
--- /dev/null
@@ -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 (executable)
index 0000000..32dfc6a
--- /dev/null
@@ -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 (executable)
index 0000000..cf2b879
--- /dev/null
@@ -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 (executable)
index 0000000..c799591
--- /dev/null
@@ -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 (executable)
index 0000000..791f128
--- /dev/null
@@ -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 (executable)
index 0000000..ff95abe
--- /dev/null
@@ -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 (executable)
index 0000000..1f7a01c
--- /dev/null
@@ -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 (executable)
index 0000000..ad33775
--- /dev/null
@@ -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