Hi @chrisldavis
One of our talented teammates, Mario, has written to script to remove the zfs dependences on an antlet.
You can copy this script to your antsle and mark it as executable:
chmod +x rmzfsdeps
rmzfsdeps antlet_name
Once the zfs dependencies have been removed, you should be able to remove the old antlet.
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: rmzfsdeps <antlet-name>"
echo " "
exit 1
fi
antlet_name=$1
#######################################################
# Functions
# Text color
red=$'\e[1;31m'
grn=$'\e[1;32m'
wht=$'\e[1;0m'
isAntlet() {
# Desc: Verify the antlet exists
# Args: $1 -> name of the antlet
antlet_name=$1
if [ `virsh -c qemu:///system list --name --all | grep "^${antlet_name}$"|wc -l` -eq "1" ]; then
echo "true"
return 0
elif [ `virsh -c lxc:/// list --name --all | grep "^${antlet_name}$"|wc -l` -eq "1" ]; then
echo "true"
return 0
else
echo "false"
return 1
fi
}
isAntletRunning() {
# Desc: Verify the antlet exists
# Args: $1 -> name of the antlet
antlet_name=$1
if [ `virsh -c qemu:///system list --name | grep "^${antlet_name}$"|wc -l` -eq "1" ]; then
echo "true"
return 0
elif [ `virsh -c lxc:/// list --name | grep "^${antlet_name}$"|wc -l` -eq "1" ]; then
echo "true"
return 0
else
echo "false"
return 1
fi
}
antletType() {
# Desc: Get the antlet type - qemu or lxc
# Args: $1 -> name of the antlet
antlet_name=$1
if [ `virsh -c qemu:///system list --name --all | grep "^${antlet_name}$"|wc -l` -eq "1" ]; then
echo "qemu"
return 0
elif [ `virsh -c lxc:/// list --name --all|grep "^${antlet_name}$"|wc -l` -eq "1" ]; then
echo "lxc"
return 0
else
echo ""
return 1
fi
}
getAntletZpool() {
# Desc: get the zpool name of the antlet
# Args: $1 -> antlet name
echo `zfs list -H -o name | grep "/${1}$" | cut -d '/' -f1`
}
######################################################################
# Does antlet exist
if [ `isAntlet $antlet_name` == "false" ]; then
echo "antlet '${antlet_name}' does ${red}not exist!${wht}"
exit 1
fi
# Is the antlet running
if [ `isAntletRunning $antlet_name` == "true" ]; then
echo "'${red}${antlet_name}' is running!${wht} Please stop the antlet before running this script!"
exit 1
fi
# Set virsh cmd
if [ `antletType $antlet_name` == "lxc" ]; then
virshcmd="virsh -c lxc:///"
else
virshcmd="virsh -c qemu:///system"
fi
# Get antlet zpool
antlet_zpool=`getAntletZpool $antlet_name`
# Backup xml to antlet directory
$virshcmd dumpxml $antlet_name > /${antlet_zpool}/${antlet_name}/${antlet_name}.antlet.xml
# create snapshot
zfs snapshot ${antlet_zpool}/${antlet_name}@rmzfsdeps
# v undefine
$virshcmd undefine $antlet_name
# rename zfs with temporary name
zfs rename ${antlet_zpool}/${antlet_name} ${antlet_zpool}/${antlet_name}.tmp
# zfs send/recv
zfs send ${antlet_zpool}/${antlet_name}.tmp@rmzfsdeps | zfs recv ${antlet_zpool}/${antlet_name}
# Re-define antlet
$virshcmd define /${antlet_zpool}/${antlet_name}/${antlet_name}.antlet.xml
# destroy the snap
zfs destroy ${antlet_zpool}/${antlet_name}@rmzfsdeps
# destroy orig zfs
zfs destroy -r ${antlet_zpool}/${antlet_name}.tmp
Thanks,
antsle Support