exit 1 on existing, verbose receive
[ganeti-extstorage-zfs] / bin / adopt
1 #!/bin/sh
2
3 . /usr/share/ganeti/extstorage/zfs/defaults.sh
4
5 test -e /dev/zvol/$EXTP_ZFS/adopt && exit 1
6
7 zfs list -t snapshot -r -r $EXTP_ZFS -o name -H \
8 | iselect -p 1 -a -n 'adopt snapshot' \
9 | xargs -i sh -cx 'zfs send -R {} | zfs receive -v '$EXTP_ZFS'/adopt && zfs set ganeti:originstname="`zfs get ganeti:originstname -o value -p -H {}`+adopt" '$EXTP_ZFS'/adopt && zfs set lv:a="-" '$EXTP_ZFS'/adopt'