Antsle Forum
Welcome to our Antsle community! This forum is to connect all Antsle users to post experiences, make user-generated content available for the entire community and more.
Please note: This forum is about discussing one specific issue at a time. No generalizations. No judgments. Please check the Forum Rules before posting. If you have specific questions about your Antsle and expect a response from our team directly, please continue to use the appropriate channels (email: [email protected]) so every inquiry is tracked.
Delete clone parent?
Quote from chrisldavis on February 12, 2022, 7:54 amI created an antlet that was originally cloned from another antlet. It looks like a snapshot was made of the original antlet and used to create the clone. Now when I try to delete the original antlet it says "[antlet] has dependencies that must be deleted. Would you like to delete this antlet along with the following dependencies?"
If I try to just delete the snapshot, I get this message: "DSNAP-1: Error while trying to delete the snapshot. cannot destroy 'antlets/[antlet]@[snapshot]': snapshot has dependent clones".
I don't want to delete the new antlet, just the old one. Is it possible to simply "decouple" the snapshot from the clone? Is that an option?
I created an antlet that was originally cloned from another antlet. It looks like a snapshot was made of the original antlet and used to create the clone. Now when I try to delete the original antlet it says "[antlet] has dependencies that must be deleted. Would you like to delete this antlet along with the following dependencies?"
If I try to just delete the snapshot, I get this message: "DSNAP-1: Error while trying to delete the snapshot. cannot destroy 'antlets/[antlet]@[snapshot]': snapshot has dependent clones".
I don't want to delete the new antlet, just the old one. Is it possible to simply "decouple" the snapshot from the clone? Is that an option?
Quote from daniel.luck on February 14, 2022, 3:16 pmHi @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
fiantlet_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 antletantlet_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 antletantlet_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 antletantlet_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 nameecho `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}.tmpThanks,
antsle Support
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
fiantlet_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 antletantlet_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 antletantlet_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 antletantlet_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 nameecho `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