[lxc-devel] [PATCH] ensure btrfs subvolume is removed when container creating fails

Stéphane Graber stgraber at ubuntu.com
Wed Nov 14 15:55:38 UTC 2012


On 11/14/2012 10:47 AM, Serge Hallyn wrote:
> 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>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

And applied to staging branch.

>> -- 
>> 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
> 
> 
> ------------------------------------------------------------------------------
> 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
> 


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20121114/4bd35f44/attachment.pgp>


More information about the lxc-devel mailing list