2017-07-20 22:26:42 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -x
|
2016-03-18 14:15:17 +00:00
|
|
|
|
|
|
|
if [[ -z "${IMAGE_NAME}" ]]; then
|
|
|
|
echo image name must be provided
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
is_qemu_running() {
|
|
|
|
rbd status ${IMAGE_NAME} | grep -v "Watchers: none"
|
|
|
|
}
|
|
|
|
|
|
|
|
wait_for_qemu() {
|
|
|
|
while ! is_qemu_running ; do
|
|
|
|
echo "*** Waiting for QEMU"
|
|
|
|
sleep 30
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2016-04-03 14:29:38 +00:00
|
|
|
wait_for_qemu
|
2016-05-12 06:15:53 +00:00
|
|
|
rbd feature disable ${IMAGE_NAME} journaling
|
|
|
|
rbd feature disable ${IMAGE_NAME} fast-diff
|
|
|
|
rbd feature disable ${IMAGE_NAME} object-map
|
|
|
|
rbd feature disable ${IMAGE_NAME} exclusive-lock
|
2016-03-18 14:15:17 +00:00
|
|
|
|
|
|
|
while is_qemu_running ; do
|
|
|
|
echo "*** Enabling all features"
|
2016-05-12 06:15:53 +00:00
|
|
|
rbd feature enable ${IMAGE_NAME} exclusive-lock || break
|
|
|
|
rbd feature enable ${IMAGE_NAME} journaling || break
|
|
|
|
rbd feature enable ${IMAGE_NAME} object-map || break
|
|
|
|
rbd feature enable ${IMAGE_NAME} fast-diff || break
|
2016-03-18 14:15:17 +00:00
|
|
|
if is_qemu_running ; then
|
|
|
|
sleep 60
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "*** Disabling all features"
|
2016-05-12 06:15:53 +00:00
|
|
|
rbd feature disable ${IMAGE_NAME} journaling || break
|
|
|
|
rbd feature disable ${IMAGE_NAME} fast-diff || break
|
|
|
|
rbd feature disable ${IMAGE_NAME} object-map || break
|
|
|
|
rbd feature disable ${IMAGE_NAME} exclusive-lock || break
|
2016-03-18 14:15:17 +00:00
|
|
|
if is_qemu_running ; then
|
|
|
|
sleep 60
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2016-05-12 06:15:53 +00:00
|
|
|
if is_qemu_running ; then
|
|
|
|
echo "RBD command failed on alive QEMU"
|
|
|
|
exit 1
|
|
|
|
fi
|