[lxc-devel] [PATCH] lxc-destroy container only if it is in the STOPPED state

Stéphane Graber stgraber at ubuntu.com
Wed Dec 19 16:08:35 UTC 2012


On 12/19/2012 04:32 PM, Serge Hallyn wrote:
> Quoting Dwight Engen (dwight.engen at oracle.com):
>> Currently, lxc-destory will attempt to destroy a container if it is not in
>> the RUNNING state, but doing so is not good when the container is FROZEN, or
>> in other transitional states.
>>
>> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
> 
> Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

Applied to staging. Thanks.

>> ---
>>  src/lxc/lxc-destroy.in | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/lxc/lxc-destroy.in b/src/lxc/lxc-destroy.in
>> index c72f18a..1527495 100644
>> --- a/src/lxc/lxc-destroy.in
>> +++ b/src/lxc/lxc-destroy.in
>> @@ -94,14 +94,14 @@ if [ ! -d "$lxc_path/$lxc_name" ]; then
>>      exit 1
>>  fi
>>  
>> -# make sure the container isn't running
>> -lxc-info -n $lxc_name 2>/dev/null | grep -q RUNNING
>> -if [ $? -eq 0 ]; then
>> +# make sure the container is stopped
>> +state=`lxc-info -n $lxc_name 2>/dev/null | head -1 |awk '{print $2}'`
>> +if [ $state != "STOPPED" ]; then
>>      if [ $force -eq 1 ]; then
>>          lxc-stop -n $lxc_name
>>          lxc-wait -n $lxc_name -s STOPPED
>>      else
>> -        echo "$(basename $0): '$lxc_name' is running; aborted" >&2
>> +        echo "$(basename $0): '$lxc_name' is $state; aborted" >&2
>>          exit 1
>>      fi
>>  fi
>> -- 
>> 1.7.12.3
>>
>>
>> ------------------------------------------------------------------------------
>> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>> Remotely access PCs and mobile devices and provide instant support
>> Improve your efficiency, and focus on delivering more value-add services
>> Discover what IT Professionals Know. Rescue delivers
>> http://p.sf.net/sfu/logmein_12329d2d
>> _______________________________________________
>> Lxc-devel mailing list
>> Lxc-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/lxc-devel
> 
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> 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/20121219/d339e192/attachment.pgp>


More information about the lxc-devel mailing list