Commit e2e0ee25 by Serge E. Hallyn Committed by Daniel Lezcano

lxc-destroy: delete a rootfs if it is an lvm volume

If this is acceptable as is, then I'll try to get a simple lxc-clone out tomorrow (taking into account your comments from last time). Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 9ccb2dbc
...@@ -75,5 +75,15 @@ if [ ! -d "$lxc_path/$lxc_name" ]; then ...@@ -75,5 +75,15 @@ if [ ! -d "$lxc_path/$lxc_name" ]; then
exit 1 exit 1
fi fi
# Deduce the type of rootfs
# If LVM partition, destroy it. If anything else, ignore it. We'll support
# deletion of others later.
rootdev=`grep lxc.rootfs $lxc_path/$lxc_name/config | awk -F= '{ print $2 '}`
if [ -b $rootdev -o -h $rootdev ]; then
lvdisplay $rootdev > /dev/null 2>&1
if [ $? -eq 0 ]; then
lvremove $rootdev
fi
fi
# recursively remove the container to remove old container configuration # recursively remove the container to remove old container configuration
rm -rf --preserve-root $lxc_path/$lxc_name rm -rf --preserve-root $lxc_path/$lxc_name
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment