3 # Copyright (C) 2015 Intel <contact@intel.com.com>
4 # Copyright (C) 2014, 2015 Red Hat <contact@redhat.com>
6 # Author: Xiaoxi Chen <xiaoxi.chen@intel.com>
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)
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.
19 source $CEPH_ROOT/qa
/standalone
/ceph-helpers.sh
25 export CEPH_MON
="127.0.0.1:7108" # git grep '\<7108\>' : there must be only one
27 CEPH_ARGS
+="--fsid=$(uuidgen) --auth-supported=none "
28 CEPH_ARGS
+="--mon-host=$CEPH_MON "
30 local funcs
=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
31 for func
in $funcs ; do
32 setup
$dir ||
return 1
33 $func $dir ||
return 1
34 teardown
$dir ||
return 1
38 function markdown_N_impl
() {
42 for i
in `seq 1 $markdown_times`
46 ceph osd tree |
grep osd
.0 |
grep up ||
return 1
48 # override any dup setting in the environment to ensure we do this
49 # exactly once (modulo messenger failures, at least; we can't *actually*
50 # provide exactly-once semantics for mon commands).
51 CEPH_CLI_TEST_DUP_COMMAND
=0 ceph osd down
0
57 function TEST_markdown_exceed_maxdown_count
() {
60 run_mon
$dir a ||
return 1
61 run_mgr
$dir x ||
return 1
62 run_osd
$dir 0 ||
return 1
63 run_osd
$dir 1 ||
return 1
64 run_osd
$dir 2 ||
return 1
66 create_rbd_pool ||
return 1
68 # 3+1 times within 300s, osd should stay dead on the 4th time
72 ceph tell osd
.0 injectargs
'--osd_max_markdown_count '$count'' ||
return 1
73 ceph tell osd
.0 injectargs
'--osd_max_markdown_period '$period'' ||
return 1
75 markdown_N_impl $
(($count+1)) $period $sleeptime
76 # down N+1 times ,the osd.0 shoud die
77 ceph osd tree |
grep down |
grep osd
.0 ||
return 1
80 function TEST_markdown_boot
() {
83 run_mon
$dir a ||
return 1
84 run_mgr
$dir x ||
return 1
85 run_osd
$dir 0 ||
return 1
86 run_osd
$dir 1 ||
return 1
87 run_osd
$dir 2 ||
return 1
89 create_rbd_pool ||
return 1
91 # 3 times within 120s, should stay up
95 ceph tell osd
.0 injectargs
'--osd_max_markdown_count '$count'' ||
return 1
96 ceph tell osd
.0 injectargs
'--osd_max_markdown_period '$period'' ||
return 1
98 markdown_N_impl
$count $period $sleeptime
99 #down N times, osd.0 should be up
100 sleep 15 # give osd plenty of time to notice and come back up
101 ceph osd tree |
grep up |
grep osd
.0 ||
return 1
104 function TEST_markdown_boot_exceed_time
() {
107 run_mon
$dir a ||
return 1
108 run_mgr
$dir x ||
return 1
109 run_osd
$dir 0 ||
return 1
110 run_osd
$dir 1 ||
return 1
111 run_osd
$dir 2 ||
return 1
113 create_rbd_pool ||
return 1
115 # 3+1 times, but over 40s, > 20s, so should stay up
119 ceph tell osd
.0 injectargs
'--osd_max_markdown_count '$count'' ||
return 1
120 ceph tell osd
.0 injectargs
'--osd_max_markdown_period '$period'' ||
return 1
122 markdown_N_impl $
(($count+1)) $period $sleeptime
123 sleep 15 # give osd plenty of time to notice and come back up
124 ceph osd tree |
grep up |
grep osd
.0 ||
return 1
127 main osd-markdown
"$@"
130 # compile-command: "cd ../.. ; make -j4 && test/osd/osd-bench.sh"