]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/workunits/rbd: tweaks to use RBD_MIRROR_USE_EXISTING_CLUSTER locally
authorMykola Golub <mgolub@mirantis.com>
Mon, 12 Dec 2016 12:20:04 +0000 (14:20 +0200)
committerMykola Golub <mgolub@mirantis.com>
Wed, 1 Feb 2017 09:55:03 +0000 (10:55 +0100)
This var is mostly used when running rbd_mirror test scripts on
teuthology.  It can be used locally though to speedup re-running the
tests:

Set a test temp directory:

  export RBD_MIRROR_TEMDIR=/tmp/tmp.rbd_mirror

Run the tests the first time with NOCLEANUP flag (the cluster and
daemons are not stopped on finish):

  RBD_MIRROR_NOCLEANUP=1 ../qa/workunits/rbd/rbd_mirror.sh

Now, to re-run the test without restarting the cluster, run cleanup
with USE_EXISTING_CLUSTER flag:

  RBD_MIRROR_USE_EXISTING_CLUSTER=1 \
    ../qa/workunits/rbd/rbd_mirror_ha.sh cleanup

and then run the tests:

  RBD_MIRROR_USE_EXISTING_CLUSTER=1
    ../qa/workunits/rbd/rbd_mirror_ha.sh

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
qa/workunits/rbd/rbd_mirror_helpers.sh

index 24c9000bca6c7f19e9614a7d021ac4a4cc43404d..a930866c3642981fc0ff345fc8d7f8c39e75e418 100755 (executable)
@@ -180,8 +180,10 @@ setup()
     trap cleanup INT TERM EXIT
 
     if [ -n "${RBD_MIRROR_TEMDIR}" ]; then
+       test -d "${RBD_MIRROR_TEMDIR}" ||
        mkdir "${RBD_MIRROR_TEMDIR}"
        TEMPDIR="${RBD_MIRROR_TEMDIR}"
+       cd ${TEMPDIR}
     else
        TEMPDIR=`mktemp -d`
     fi
@@ -191,8 +193,10 @@ setup()
         ${CEPH_SRC}/mstart.sh ${CLUSTER1} -n ${RBD_MIRROR_VARGS}
         ${CEPH_SRC}/mstart.sh ${CLUSTER2} -n ${RBD_MIRROR_VARGS}
 
+       rm -f ${TEMPDIR}/${CLUSTER1}.conf
         ln -s $(readlink -f run/${CLUSTER1}/ceph.conf) \
            ${TEMPDIR}/${CLUSTER1}.conf
+       rm -f ${TEMPDIR}/${CLUSTER2}.conf
         ln -s $(readlink -f run/${CLUSTER2}/ceph.conf) \
            ${TEMPDIR}/${CLUSTER2}.conf
 
@@ -238,6 +242,7 @@ cleanup()
         ceph --cluster ${CLUSTER1} osd pool rm ${PARENT_POOL} ${PARENT_POOL} --yes-i-really-really-mean-it
         ceph --cluster ${CLUSTER2} osd pool rm ${PARENT_POOL} ${PARENT_POOL} --yes-i-really-really-mean-it
     fi
+    test "${RBD_MIRROR_TEMDIR}" = "${TEMPDIR}" ||
     rm -Rf ${TEMPDIR}
 }