]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
map-unmap.sh: fail if 'rbd rm' fails 2041/head
authorIlya Dryomov <ilya.dryomov@inktank.com>
Thu, 26 Jun 2014 13:34:19 +0000 (17:34 +0400)
committerIlya Dryomov <ilya.dryomov@inktank.com>
Sun, 29 Jun 2014 17:58:15 +0000 (21:58 +0400)
Fail if 'rbd rm' fails - most probably it'd fail with "image still has
watchers" and in that case it's a bug in the kernel client which we do
want to notice.  Also nuke the trap-based error handling - cleanup() is
half-baked and not really necessary here.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
qa/workunits/rbd/map-unmap.sh

index a6fb50494521c7b3437f7799a7a1ae76eb39cf02..ce7d20fca0adf08823fc4a3868856d7abee249c5 100755 (executable)
@@ -21,28 +21,14 @@ function map_unmap() {
        [ $# -eq 1 ] || exit 99
        local image_name="$1"
 
-       DEV="$(sudo rbd map "${image_name}")"
-       sudo rbd unmap "${DEV}"
+       local dev
+       dev="$(sudo rbd map "${image_name}")"
+       sudo rbd unmap "${dev}"
 }
 
-function setup() {
-       [ $# -eq 2 ] || exit 99
-       local image_name="$1"
-       local image_size="$2"
-
-       rbd create "${image_name}" --size="${image_size}"
-}
-
-function cleanup() {
-       # Have to rely on globals for the trap call
-       # rbd unmap "${DEV}"                    || true
-       rbd rm "${IMAGE_NAME}"                  || true
-}
-trap cleanup EXIT HUP INT
-
 #### Start
 
-setup "${IMAGE_NAME}" "${IMAGE_SIZE}"
+rbd create "${IMAGE_NAME}" --size="${IMAGE_SIZE}"
 
 COUNT=0
 START_TIME=$(get_time)
@@ -53,6 +39,6 @@ while ! times_up "${END_TIME}"; do
 done
 ELAPSED=$(expr "$(get_time)" - "${START_TIME}")
 
-echo "${COUNT} iterations completed in ${ELAPSED} seconds"
+rbd rm "${IMAGE_NAME}"
 
-exit 0
+echo "${COUNT} iterations completed in ${ELAPSED} seconds"