[lxc-devel] [PATCH 1/1] lxc-create: cleanup whenever exiting with error

Stéphane Graber stgraber at ubuntu.com
Wed Apr 24 23:53:38 UTC 2013


On 04/25/2013 01:46 AM, Serge Hallyn wrote:
> Quoting Stéphane Graber (stgraber at ubuntu.com):
>> On 04/24/2013 10:16 PM, Serge Hallyn wrote:
>>> Otherwise we leave bad containers sitting around and further confuse
>>> things on retries.
>>>
>>> Reported-by: Mukanyiligira Didacienne <siyana223 at gmail.com>
>>> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
>>> ---
>>>  src/lxc/lxc-create.in | 10 +++++-----
>>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in
>>> index fbb566f..553ffd2 100644
>>> --- a/src/lxc/lxc-create.in
>>> +++ b/src/lxc/lxc-create.in
>>> @@ -286,7 +286,7 @@ fi
>>>  
>>>  if [ ! -r "$lxc_config" ]; then
>>>      echo "$(basename $0): '$lxc_config' configuration file not found" >&2
>>> -    exit 1
>>> +    cleanup
>>>  fi
>>
>> Isn't this test before the one for already existing containers and so
>> would lead to a lxc-destroy of the existing container?
> 
> No.  The check for existing container is at line 208.  The check further
> down is for the rootfs - which could be an LV.
> 
> -serge

Bah, I really shouldn't be reviewing patches this late ;)

Anyway, you're absolutely right.

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


-- 
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: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130425/b1a8b44b/attachment.pgp>


More information about the lxc-devel mailing list