rbd-nbd: script that can be hooked to quiesce/unquiesce events

Signed-off-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
Mykola Golub 2020-04-27 09:04:33 +01:00
parent 1d01295494
commit 6e7d4f963b

View File

@ -0,0 +1,31 @@
#!/bin/sh
echo "$0 $@" >&2
if [ $# -lt 2 ]; then
echo "usage: $0 <dev> <cmd>" >&2
exit 1
fi
dev=$1
cmd=$2
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
findmnt -S "${dev}" -fno TARGET |
while read mnt; do
case "${cmd}" in
quiesce)
echo "freezing ${mnt}" >&2
fsfreeze -f "${mnt}"
;;
unquiesce)
echo "unfreezing ${mnt}" >&2
fsfreeze -u "${mnt}"
;;
*)
echo "unknown command ${cmd}" >&2
exit 1
;;
esac
done