[lxc-devel] [PATCH] ensure btrfs subvolume is removed when container creating fails
Serge Hallyn
serge.hallyn at canonical.com
Wed Nov 14 15:47:07 UTC 2012
Quoting Frederic Crozat (fcrozat at suse.com):
> Hi,
>
> while updating our package for LXC 0.8.0, I discovered that lxc-create
> didn't properly delete btrfs subvolume if container creation failed for
> any reason.
>
> Attached patch fixes this issue.
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> --
> Frederic Crozat <fcrozat at suse.com>
> SUSE
> >From 028d1b3eb110229113dc99f3587fac1f9fca9b0e Mon Sep 17 00:00:00 2001
> From: Frederic Crozat <fcrozat at suse.com>
> Date: Wed, 14 Nov 2012 16:02:37 +0100
> Subject: [PATCH] Ensure btrfs subvolume is destroyed on error
>
> ---
> src/lxc/lxc-create.in | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in
> index b21cdc3..124ffd5 100644
> --- a/src/lxc/lxc-create.in
> +++ b/src/lxc/lxc-create.in
> @@ -237,6 +237,8 @@ cleanup() {
> if [ $backingstore = "lvm" ]; then
> umount $rootfs
> lvremove -f $rootdev
> + elif [ $backingstore = "btrfs" ]; then
> + btrfs subvolume delete "$rootfs"
> fi
> ${bindir}/lxc-destroy -n $lxc_name
> echo "$(basename $0): aborted" >&2
> --
> 1.7.10.4
>
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
More information about the lxc-devel
mailing list