From: Ilya Dryomov Date: Thu, 26 Jun 2014 13:34:19 +0000 (+0400) Subject: map-unmap.sh: fail if 'rbd rm' fails X-Git-Tag: v0.84~168^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2041%2Fhead;p=ceph.git map-unmap.sh: fail if 'rbd rm' fails 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 --- diff --git a/qa/workunits/rbd/map-unmap.sh b/qa/workunits/rbd/map-unmap.sh index a6fb50494521..ce7d20fca0ad 100755 --- a/qa/workunits/rbd/map-unmap.sh +++ b/qa/workunits/rbd/map-unmap.sh @@ -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"