]> git.proxmox.com Git - ceph.git/blame - ceph/qa/standalone/mon/mon-handle-forward.sh
Import ceph 15.2.8
[ceph.git] / ceph / qa / standalone / mon / mon-handle-forward.sh
CommitLineData
11fdf7f2 1#!/usr/bin/env bash
7c673cae
FG
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#
c07f9fc5 18source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
7c673cae
FG
19
20function run() {
21 local dir=$1
22
23 setup $dir || return 1
24
25 MONA=127.0.0.1:7300
26 MONB=127.0.0.1:7301
27 (
c07f9fc5 28 FSID=$(uuidgen)
7c673cae
FG
29 export CEPH_ARGS
30 CEPH_ARGS+="--fsid=$FSID --auth-supported=none "
31 CEPH_ARGS+="--mon-initial-members=a,b --mon-host=$MONA,$MONB "
32 run_mon $dir a --public-addr $MONA || return 1
33 run_mon $dir b --public-addr $MONB || return 1
34 )
35
f91f0fd5 36 timeout 360 ceph --mon-host-override $MONA mon stat || return 1
7c673cae 37 # check that MONB is indeed a peon
c07f9fc5 38 ceph --admin-daemon $(get_asok_path mon.b) mon_status |
7c673cae
FG
39 grep '"peon"' || return 1
40 # when the leader ( MONA ) is used, there is no message forwarding
f91f0fd5 41 ceph --mon-host-override $MONA osd pool create POOL1 12
c07f9fc5 42 CEPH_ARGS='' ceph --admin-daemon $(get_asok_path mon.a) log flush || return 1
11fdf7f2 43 grep 'mon_command(.*"POOL1"' $dir/mon.a.log || return 1
c07f9fc5 44 CEPH_ARGS='' ceph --admin-daemon $(get_asok_path mon.b) log flush || return 1
7c673cae
FG
45 grep 'mon_command(.*"POOL1"' $dir/mon.b.log && return 1
46 # when the peon ( MONB ) is used, the message is forwarded to the leader
f91f0fd5 47 ceph --mon-host-override $MONB osd pool create POOL2 12
c07f9fc5 48 CEPH_ARGS='' ceph --admin-daemon $(get_asok_path mon.b) log flush || return 1
11fdf7f2 49 grep 'forward_request.*mon_command(.*"POOL2"' $dir/mon.b.log || return 1
c07f9fc5 50 CEPH_ARGS='' ceph --admin-daemon $(get_asok_path mon.a) log flush || return 1
11fdf7f2 51 grep ' forward(mon_command(.*"POOL2"' $dir/mon.a.log || return 1
7c673cae
FG
52 # forwarded messages must retain features from the original connection
53 features=$(sed -n -e 's|.*127.0.0.1:0.*accept features \([0-9][0-9]*\)|\1|p' < \
54 $dir/mon.b.log)
11fdf7f2 55 grep ' forward(mon_command(.*"POOL2".*con_features '$features $dir/mon.a.log || return 1
7c673cae
FG
56
57 teardown $dir || return 1
58}
59
60main mon-handle-forward "$@"
61
62# Local Variables:
63# compile-command: "cd ../.. ; make -j4 TESTS=test/mon/mon-handle-forward.sh check"
64# End: