Revision 109 (by dpavlin, 2009/06/06 16:57:37) use configured veid all over
#!/bin/sh -x

veid=60018

fs=`zfs list | grep @ | iselect -t "select snapshot to clone into $veid" -a | sed 's/ .*$//'`

if [ -z "$fs" ] ; then
	exit;
fi

orig=`echo $fs | cut -d/ -f3 | cut -d@ -f1`
pool=`echo $fs | cut -d/ -f1`

echo "clone $fs -- $orig to $veid";

clone=$pool/clone/$orig-$veid

vzctl stop $veid && (
	umount /$clone
	zfs list | grep ^$clone
	zfs destroy $clone
)

zfs clone $fs $pool/clone/$orig-$veid

vzctl start $veid

vzlist -a