]> git.proxmox.com Git - ceph.git/blob - ceph/qa/workunits/rbd/rbd_mirror_bootstrap.sh
fb77c0d9bf869f5665042c4666e5ce30446296dd
[ceph.git] / ceph / qa / workunits / rbd / rbd_mirror_bootstrap.sh
1 #!/bin/sh -ex
2 #
3 # rbd_mirror_bootstrap.sh - test peer bootstrap create/import
4 #
5
6 RBD_MIRROR_MANUAL_PEERS=1
7 RBD_MIRROR_INSTANCES=${RBD_MIRROR_INSTANCES:-1}
8 . $(dirname $0)/rbd_mirror_helpers.sh
9
10 setup
11
12 testlog "TEST: bootstrap cluster2 from cluster1"
13 # create token on cluster1 and import to cluster2
14 TOKEN=${TEMPDIR}/peer-token
15 TOKEN_2=${TEMPDIR}/peer-token-2
16 CEPH_ARGS='' rbd --cluster ${CLUSTER1} mirror pool peer bootstrap create ${POOL} > ${TOKEN}
17 CEPH_ARGS='' rbd --cluster ${CLUSTER1} mirror pool peer bootstrap create ${PARENT_POOL} > ${TOKEN_2}
18 cmp ${TOKEN} ${TOKEN_2}
19
20 CEPH_ARGS='' rbd --cluster ${CLUSTER2} --pool ${POOL} mirror pool peer bootstrap import ${TOKEN} --direction rx-only
21 CEPH_ARGS='' rbd --cluster ${CLUSTER2} --pool ${PARENT_POOL} mirror pool peer bootstrap import ${TOKEN} --direction rx-tx
22
23 start_mirrors ${CLUSTER1}
24 start_mirrors ${CLUSTER2}
25
26 testlog "TEST: verify rx-only direction"
27 [ "$(rbd --cluster ${CLUSTER1} --pool ${POOL} mirror pool info --format xml |
28 ${XMLSTARLET} sel -t -v '//mirror/peers/peer[1]/uuid')" = "" ]
29
30 create_image_and_enable_mirror ${CLUSTER1} ${POOL} image1
31
32 wait_for_image_replay_started ${CLUSTER2} ${POOL} image1
33 write_image ${CLUSTER1} ${POOL} image1 100
34 wait_for_replay_complete ${CLUSTER2} ${CLUSTER1} ${POOL} image1
35
36 testlog "TEST: verify rx-tx direction"
37 create_image ${CLUSTER1} ${PARENT_POOL} image1
38 create_image ${CLUSTER2} ${PARENT_POOL} image2
39
40 enable_mirror ${CLUSTER1} ${PARENT_POOL} image1
41 enable_mirror ${CLUSTER2} ${PARENT_POOL} image2
42
43 wait_for_image_replay_started ${CLUSTER2} ${PARENT_POOL} image1
44 write_image ${CLUSTER1} ${PARENT_POOL} image1 100
45 wait_for_replay_complete ${CLUSTER2} ${CLUSTER1} ${PARENT_POOL} image1
46
47 wait_for_image_replay_started ${CLUSTER1} ${PARENT_POOL} image2
48 write_image ${CLUSTER2} ${PARENT_POOL} image2 100
49 wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${PARENT_POOL} image2