mirror of
https://github.com/ceph/ceph
synced 2025-01-02 00:52:22 +00:00
qa/workunits/rbd: added tests for --snap-id
Fixes: https://tracker.ceph.com/issues/57902 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
parent
614c91c005
commit
92480e6561
@ -253,6 +253,13 @@ get_pid ${POOL}
|
|||||||
unmap_device "${IMAGE}@snap" ${PID}
|
unmap_device "${IMAGE}@snap" ${PID}
|
||||||
DEV=
|
DEV=
|
||||||
|
|
||||||
|
# map/unmap snap test with --snap-id
|
||||||
|
SNAPID=`rbd snap ls ${POOL}/${IMAGE} | awk '$2 == "snap" {print $1}'`
|
||||||
|
DEV=`_sudo rbd device --device-type nbd map --snap-id ${SNAPID} ${POOL}/${IMAGE}`
|
||||||
|
get_pid ${POOL}
|
||||||
|
unmap_device "--snap-id ${SNAPID} ${IMAGE}" ${PID}
|
||||||
|
DEV=
|
||||||
|
|
||||||
# map/unmap namespace test
|
# map/unmap namespace test
|
||||||
rbd snap create ${POOL}/${NS}/${IMAGE}@snap
|
rbd snap create ${POOL}/${NS}/${IMAGE}@snap
|
||||||
DEV=`_sudo rbd device --device-type nbd map ${POOL}/${NS}/${IMAGE}@snap`
|
DEV=`_sudo rbd device --device-type nbd map ${POOL}/${NS}/${IMAGE}@snap`
|
||||||
@ -260,6 +267,13 @@ get_pid ${POOL} ${NS}
|
|||||||
unmap_device "${POOL}/${NS}/${IMAGE}@snap" ${PID}
|
unmap_device "${POOL}/${NS}/${IMAGE}@snap" ${PID}
|
||||||
DEV=
|
DEV=
|
||||||
|
|
||||||
|
# map/unmap namespace test with --snap-id
|
||||||
|
SNAPID=`rbd snap ls ${POOL}/${NS}/${IMAGE} | awk '$2 == "snap" {print $1}'`
|
||||||
|
DEV=`_sudo rbd device --device-type nbd map --snap-id ${SNAPID} ${POOL}/${NS}/${IMAGE}`
|
||||||
|
get_pid ${POOL} ${NS}
|
||||||
|
unmap_device "--snap-id ${SNAPID} ${POOL}/${NS}/${IMAGE}" ${PID}
|
||||||
|
DEV=
|
||||||
|
|
||||||
# map/unmap namespace using options test
|
# map/unmap namespace using options test
|
||||||
DEV=`_sudo rbd device --device-type nbd map --pool ${POOL} --namespace ${NS} --image ${IMAGE}`
|
DEV=`_sudo rbd device --device-type nbd map --pool ${POOL} --namespace ${NS} --image ${IMAGE}`
|
||||||
get_pid ${POOL} ${NS}
|
get_pid ${POOL} ${NS}
|
||||||
@ -409,4 +423,21 @@ if [ -n "${COOKIE}" ]; then
|
|||||||
unmap_device ${DEV} ${PID}
|
unmap_device ${DEV} ${PID}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# test detach/attach with --snap-id
|
||||||
|
SNAPID=`rbd snap ls ${POOL}/${IMAGE} | awk '$2 == "snap" {print $1}'`
|
||||||
|
OUT=`_sudo rbd device --device-type nbd --options try-netlink,show-cookie map --snap-id ${SNAPID} ${POOL}/${IMAGE}`
|
||||||
|
read DEV COOKIE <<< "${OUT}"
|
||||||
|
get_pid ${POOL}
|
||||||
|
_sudo rbd device detach ${POOL}/${IMAGE} --snap-id ${SNAPID} --device-type nbd
|
||||||
|
expect_false get_pid ${POOL}
|
||||||
|
expect_false _sudo rbd device attach --device ${DEV} --snap-id ${SNAPID} ${POOL}/${IMAGE} --device-type nbd
|
||||||
|
if [ -n "${COOKIE}" ]; then
|
||||||
|
_sudo rbd device attach --device ${DEV} --cookie ${COOKIE} --snap-id ${SNAPID} ${POOL}/${IMAGE} --device-type nbd
|
||||||
|
else
|
||||||
|
_sudo rbd device attach --device ${DEV} --snap-id ${SNAPID} ${POOL}/${IMAGE} --device-type nbd --force
|
||||||
|
fi
|
||||||
|
get_pid ${POOL}
|
||||||
|
_sudo rbd device detach ${DEV} --device-type nbd
|
||||||
|
expect_false get_pid ${POOL}
|
||||||
|
|
||||||
echo OK
|
echo OK
|
||||||
|
Loading…
Reference in New Issue
Block a user