]> git.proxmox.com Git - ceph.git/blob - ceph/qa/standalone/osd/osd-copy-from.sh
update sources to v12.1.2
[ceph.git] / ceph / qa / standalone / osd / osd-copy-from.sh
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 $CEPH_ROOT/qa/standalone/ceph-helpers.sh
21
22 function run() {
23 local dir=$1
24 shift
25
26 export CEPH_MON="127.0.0.1:7111" # git grep '\<7111\>' : there must be only one
27 export CEPH_ARGS
28 CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
29 CEPH_ARGS+="--mon-host=$CEPH_MON "
30
31 local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
32 for func in $funcs ; do
33 setup $dir || return 1
34 $func $dir || return 1
35 teardown $dir || return 1
36 done
37 }
38
39 function TEST_copy_from() {
40 local dir=$1
41
42 run_mon $dir a || return 1
43 run_mgr $dir x || return 1
44 run_osd $dir 0 || return 1
45 run_osd $dir 1 || return 1
46 create_rbd_pool || 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: