]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com> | |
4 | # Copyright (C) 2014, 2015 Red Hat <contact@redhat.com> | |
5 | # | |
6 | # Author: Loic Dachary <loic@dachary.org> | |
7 | # Author: Sage Weil <sage@redhat.com> | |
8 | # | |
9 | # This program is free software; you can redistribute it and/or modify | |
10 | # it under the terms of the GNU Library Public License as published by | |
11 | # the Free Software Foundation; either version 2, or (at your option) | |
12 | # any later version. | |
13 | # | |
14 | # This program is distributed in the hope that it will be useful, | |
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | # GNU Library Public License for more details. | |
18 | # | |
19 | ||
20 | source $(dirname $0)/../detect-build-env-vars.sh | |
21 | source $CEPH_ROOT/qa/workunits/ceph-helpers.sh | |
22 | ||
23 | function run() { | |
24 | local dir=$1 | |
25 | shift | |
26 | ||
27 | export CEPH_MON="127.0.0.1:7111" # git grep '\<7111\>' : there must be only one | |
28 | export CEPH_ARGS | |
29 | CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " | |
30 | CEPH_ARGS+="--mon-host=$CEPH_MON " | |
31 | ||
32 | local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')} | |
33 | for func in $funcs ; do | |
34 | setup $dir || return 1 | |
35 | $func $dir || return 1 | |
36 | teardown $dir || return 1 | |
37 | done | |
38 | } | |
39 | ||
40 | function TEST_copy_from() { | |
41 | local dir=$1 | |
42 | ||
43 | run_mon $dir a || return 1 | |
44 | run_mgr $dir x || return 1 | |
45 | run_osd $dir 0 || return 1 | |
46 | run_osd $dir 1 || return 1 | |
47 | ||
48 | # success | |
49 | rados -p rbd put foo $(which rados) | |
50 | rados -p rbd cp foo foo2 | |
51 | rados -p rbd stat foo2 | |
52 | ||
53 | # failure | |
54 | ceph tell osd.\* injectargs -- --osd-debug-inject-copyfrom-error | |
55 | ! rados -p rbd cp foo foo3 | |
56 | ! rados -p rbd stat foo3 | |
57 | ||
58 | # success again | |
59 | ceph tell osd.\* injectargs -- --no-osd-debug-inject-copyfrom-error | |
60 | ! rados -p rbd cp foo foo3 | |
61 | rados -p rbd stat foo3 | |
62 | } | |
63 | ||
64 | main osd-copy-from "$@" | |
65 | ||
66 | # Local Variables: | |
67 | # compile-command: "cd ../.. ; make -j4 && test/osd/osd-bench.sh" | |
68 | # End: |