]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com> | |
4 | # Copyright (C) 2014,2015 Red Hat <contact@redhat.com> | |
5 | # | |
6 | # Author: Loic Dachary <loic@dachary.org> | |
7 | # | |
8 | # This program is free software; you can redistribute it and/or modify | |
9 | # it under the terms of the GNU Library Public License as published by | |
10 | # the Free Software Foundation; either version 2, or (at your option) | |
11 | # any later version. | |
12 | # | |
13 | # This program is distributed in the hope that it will be useful, | |
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | # GNU Library Public License for more details. | |
17 | # | |
18 | source $(dirname $0)/../detect-build-env-vars.sh | |
19 | source $CEPH_ROOT/qa/workunits/ceph-helpers.sh | |
20 | ||
21 | function run() { | |
22 | local dir=$1 | |
23 | ||
24 | setup $dir || return 1 | |
25 | ||
26 | MONA=127.0.0.1:7300 | |
27 | MONB=127.0.0.1:7301 | |
28 | ( | |
29 | FSID=$(uuidgen) | |
30 | export CEPH_ARGS | |
31 | CEPH_ARGS+="--fsid=$FSID --auth-supported=none " | |
32 | CEPH_ARGS+="--mon-initial-members=a,b --mon-host=$MONA,$MONB " | |
33 | run_mon $dir a --public-addr $MONA || return 1 | |
34 | run_mon $dir b --public-addr $MONB || return 1 | |
35 | ) | |
36 | ||
37 | timeout 360 ceph --mon-host $MONA mon stat || return 1 | |
38 | # check that MONB is indeed a peon | |
39 | ceph --admin-daemon $dir/ceph-mon.b.asok mon_status | | |
40 | grep '"peon"' || return 1 | |
41 | # when the leader ( MONA ) is used, there is no message forwarding | |
42 | ceph --mon-host $MONA osd pool create POOL1 12 | |
43 | CEPH_ARGS='' ceph --admin-daemon $dir/ceph-mon.a.asok log flush || return 1 | |
44 | grep 'mon_command(.*"POOL1"' $dir/a/mon.a.log | |
45 | CEPH_ARGS='' ceph --admin-daemon $dir/ceph-mon.b.asok log flush || return 1 | |
46 | grep 'mon_command(.*"POOL1"' $dir/mon.b.log && return 1 | |
47 | # when the peon ( MONB ) is used, the message is forwarded to the leader | |
48 | ceph --mon-host $MONB osd pool create POOL2 12 | |
49 | CEPH_ARGS='' ceph --admin-daemon $dir/ceph-mon.b.asok log flush || return 1 | |
50 | grep 'forward_request.*mon_command(.*"POOL2"' $dir/mon.b.log | |
51 | CEPH_ARGS='' ceph --admin-daemon $dir/ceph-mon.a.asok log flush || return 1 | |
52 | grep ' forward(mon_command(.*"POOL2"' $dir/mon.a.log | |
53 | # forwarded messages must retain features from the original connection | |
54 | features=$(sed -n -e 's|.*127.0.0.1:0.*accept features \([0-9][0-9]*\)|\1|p' < \ | |
55 | $dir/mon.b.log) | |
56 | grep ' forward(mon_command(.*"POOL2".*con_features '$features $dir/mon.a.log | |
57 | ||
58 | teardown $dir || return 1 | |
59 | } | |
60 | ||
61 | main mon-handle-forward "$@" | |
62 | ||
63 | # Local Variables: | |
64 | # compile-command: "cd ../.. ; make -j4 TESTS=test/mon/mon-handle-forward.sh check" | |
65 | # End: |