[lxc-devel] Lxc-devel Digest, Vol 51, Issue 10

Han Yuejuan-B42073 B42073 at freescale.com
Thu Nov 15 04:08:06 UTC 2012


Hello all,
     I use following way to start a container as a daemon:
    lxc-start –n <CONTAINER_NAME> -d
    and then connect to it using lxc-console:
    lxc-console -n <CONTAINER_NAME>
But there is a problem:
When execute "  lxc-console -n <CONTAINER_NAME>", then it will come with "lxc-console: 'ctx1' is stopped"
Anyone has ideas about this?

________________________________________
From: lxc-devel-request at lists.sourceforge.net [lxc-devel-request at lists.sourceforge.net]
Sent: Wednesday, November 14, 2012 2:19 PM
To: lxc-devel at lists.sourceforge.net
Subject: Lxc-devel Digest, Vol 51, Issue 10

Send Lxc-devel mailing list submissions to
        lxc-devel at lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.sourceforge.net/lists/listinfo/lxc-devel
or, via email, send a message with subject or body 'help' to
        lxc-devel-request at lists.sourceforge.net

You can reach the person managing the list at
        lxc-devel-owner at lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Lxc-devel digest..."


Today's Topics:

   1. Re: [PATCH] Fix package name needed for building docs with
      RPM (St?phane Graber)
   2. [PATCH] Fix checkconfig to handle kernel memory cgroup    name
      change (Dwight Engen)
   3. Re: using posix shell instead of bash (Michael H. Warfield)
   4. Re: using posix shell instead of bash (St?phane Graber)
   5. Re: [PATCH] lxc-destroy: make it work with busybox (Natanael Copa)
   6. Re: [PATCH] lxc-start: add option -p, --pidfile=FILE for use
      with --daemon (Natanael Copa)


----------------------------------------------------------------------

Message: 1
Date: Wed, 14 Nov 2012 10:55:50 -0500
From: St?phane Graber <stgraber at ubuntu.com>
Subject: Re: [lxc-devel] [PATCH] Fix package name needed for building
        docs with RPM
To: Dwight Engen <dwight.engen at oracle.com>
Cc: lxc-devel at lists.sourceforge.net
Message-ID: <50A3BF06.1040300 at ubuntu.com>
Content-Type: text/plain; charset="iso-8859-1"

On 11/14/2012 10:44 AM, Dwight Engen wrote:
> Tested on Oracle Linux 6 and Fedora 17
>
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

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

And applied to staging branch.

> ---
>  lxc.spec.in |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lxc.spec.in b/lxc.spec.in
> index 10b7254..7998cfd 100644
> --- a/lxc.spec.in
> +++ b/lxc.spec.in
> @@ -30,7 +30,7 @@ Group: Applications/System
>  License: LGPL
>  BuildRoot: %{_tmppath}/%{name}-%{version}-build
>  Requires: libcap
> -BuildRequires: libcap libcap-devel docbook2x
> +BuildRequires: libcap libcap-devel docbook2X
>
>  %description
>
>


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

------------------------------

Message: 2
Date: Wed, 14 Nov 2012 12:03:56 -0500
From: Dwight Engen <dwight.engen at oracle.com>
Subject: [lxc-devel] [PATCH] Fix checkconfig to handle kernel memory
        cgroup  name change
To: lxc-devel at lists.sourceforge.net
Message-ID: <20121114120356.7c6bf92b at delphi.home>
Content-Type: text/plain; charset=US-ASCII

The kernel config option for the memory cgroup was changed in 3.6
from CONFIG_CGROUP_MEM_RES_CTLR to CONFIG_MEMCG with commit c255a458.

Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
 src/lxc/lxc-checkconfig.in |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/lxc/lxc-checkconfig.in b/src/lxc/lxc-checkconfig.in
index 8c2b5e5..8263c17 100644
--- a/src/lxc/lxc-checkconfig.in
+++ b/src/lxc/lxc-checkconfig.in
@@ -68,6 +68,15 @@ print_cgroups() {
 }

 CGROUP_MNT_PATH=`print_cgroups cgroup /proc/self/mounts | head -1`
+KVER_MAJOR=$($GREP '^# Linux' $CONFIG | \
+    sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/')
+if [[ $KVER_MAJOR == 2 ]]; then
+KVER_MINOR=$($GREP '^# Linux' $CONFIG | \
+    sed -r 's/.* 2.6.([0-9]{2}).*/\1/')
+else
+KVER_MINOR=$($GREP '^# Linux' $CONFIG | \
+    sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/')
+fi

 echo -n "Cgroup: " && is_enabled CONFIG_CGROUPS yes

@@ -80,22 +89,18 @@ fi
 echo -n "Cgroup device: " && is_enabled CONFIG_CGROUP_DEVICE
 echo -n "Cgroup sched: " && is_enabled CONFIG_CGROUP_SCHED
 echo -n "Cgroup cpu account: " && is_enabled CONFIG_CGROUP_CPUACCT
-echo -n "Cgroup memory controller: " && is_enabled CONFIG_CGROUP_MEM_RES_CTLR
+echo -n "Cgroup memory controller: "
+if [ $KVER_MAJOR -ge 3 -a $KVER_MINOR -ge 6 ]; then
+    is_enabled CONFIG_MEMCG
+else
+    is_enabled CONFIG_CGROUP_MEM_RES_CTLR
+fi
 is_set CONFIG_SMP && echo -n "Cgroup cpuset: " && is_enabled CONFIG_CPUSETS
 echo
 echo "--- Misc ---"
 echo -n "Veth pair device: " && is_enabled CONFIG_VETH
 echo -n "Macvlan: " && is_enabled CONFIG_MACVLAN
 echo -n "Vlan: " && is_enabled CONFIG_VLAN_8021Q
-KVER_MAJOR=$($GREP '^# Linux' $CONFIG | \
-    sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/')
-if [[ $KVER_MAJOR == 2 ]]; then
-KVER_MINOR=$($GREP '^# Linux' $CONFIG | \
-    sed -r 's/.* 2.6.([0-9]{2}).*/\1/')
-else
-KVER_MINOR=$($GREP '^# Linux' $CONFIG | \
-    sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/')
-fi
 echo -n "File capabilities: " &&
     ( [[ ${KVER_MAJOR} == 2 && ${KVER_MINOR} < 33 ]] &&
        is_enabled CONFIG_SECURITY_FILE_CAPABILITIES ) ||
--
1.7.1




------------------------------

Message: 3
Date: Wed, 14 Nov 2012 13:50:54 -0500
From: "Michael H. Warfield" <mhw at WittsEnd.com>
Subject: Re: [lxc-devel] using posix shell instead of bash
To: Serge Hallyn <serge.hallyn at canonical.com>
Cc: mhw at WittsEnd.com, list <lxc-devel at lists.sourceforge.net>, Lxc
Message-ID: <1352919054.5017.22.camel at canyon.wittsend.com>
Content-Type: text/plain; charset="utf-8"

On Wed, 2012-11-14 at 09:54 -0600, Serge Hallyn wrote:
> Quoting Natanael Copa (ncopa at alpinelinux.org):
> > Hi,
> >
> > I wonder if it there are any interest to make the scripts posix shell
> > compliant so they can run with for example busybox ash and dash.
> >
> > I would like to provide proper LCX support for Alpine Linux, which by
> > default runs from tmpfs. It uses uclibc and busybox as the base system,
> > which makes it very lightweight. Looking at the scripts, it seems like
> > it would be fairly easy to adjust the script to not depend on bash at
> > all, making it possible to make the LCX host even lighter.
> >
> > Before I start with sending patches, is this something that you would
> > be interested in, or are you married with bash (like the vserver ppl)?

> I don't think anyone is married to bash here.  The debian package has
> changed some scripts from bash to sh.  I'm only leery of resulting
> breakages and reports of subtle time-consuming bugs, and potentially
> less-maintainable code.

> (Note also that lxc-ls may be rewritten in python.  Is that a problem
> for your use case?)

Some reason?  Sorry.  In my "day job" I have to maintain code written in
C, bash, sh, ash (I wrote and array function library for ash and
busybox), perl and python, including a raft of stuff that interfaces to
web scrappers and SQL databases.  My team and I find python to be the
least maintainable and all the cruft that our predecessors wrote in
python is getting rewritten in perl so it can be maintained as soon as
we figure out what the hell they did in there...  We had one guy who was
absolutely in love with python and django and left us with a mess.  Now,
that may well be his fault to begin with being that it is uncommented
highly recursive web processing code (yes it uses "beautiful soup") that
drives us all nuts and breaks with nothing more that the classical
python backtrace.  I know a lot of people are just in love with python
but I wouldn't just rewrite it unless there was a really good reason to.

> > Would you be prepared for minor sacrifices to use posix compliant shell
> > scripts?

> Someone else can jump in if they object, but I personally don't.  Are
> you willing to subscribe to github.com/lxc/lxc#staging commits and
> watch for new commits re-breaking posix compliance?

Converting from bash to ash (which is very sh like) isn't too bad if you
are not making extensive use of arrays and string functions.  It's
probably doable (having done it myself with some fairly sophisticated
bash scripts dealing with LUKS encryption and file systems).  I would
start by trying to run it under busybox ash and see what breaks.

> Successful runs of https://code.launchpad.net/~serge-hallyn/+junk/lxc-test
> with your patches will also be reassuring.

> -serge

Regards,
Mike
--
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part

------------------------------

Message: 4
Date: Wed, 14 Nov 2012 14:00:15 -0500
From: St?phane Graber <stgraber at ubuntu.com>
Subject: Re: [lxc-devel] using posix shell instead of bash
To: mhw at WittsEnd.com
Cc: Serge Hallyn <serge.hallyn at canonical.com>,  list
        <lxc-devel at lists.sourceforge.net>
Message-ID: <50A3EA3F.6040405 at ubuntu.com>
Content-Type: text/plain; charset="iso-8859-1"

On 11/14/2012 01:50 PM, Michael H. Warfield wrote:
> On Wed, 2012-11-14 at 09:54 -0600, Serge Hallyn wrote:
>> Quoting Natanael Copa (ncopa at alpinelinux.org):
>>> Hi,
>>>
>>> I wonder if it there are any interest to make the scripts posix shell
>>> compliant so they can run with for example busybox ash and dash.
>>>
>>> I would like to provide proper LCX support for Alpine Linux, which by
>>> default runs from tmpfs. It uses uclibc and busybox as the base system,
>>> which makes it very lightweight. Looking at the scripts, it seems like
>>> it would be fairly easy to adjust the script to not depend on bash at
>>> all, making it possible to make the LCX host even lighter.
>>>
>>> Before I start with sending patches, is this something that you would
>>> be interested in, or are you married with bash (like the vserver ppl)?
>
>> I don't think anyone is married to bash here.  The debian package has
>> changed some scripts from bash to sh.  I'm only leery of resulting
>> breakages and reports of subtle time-consuming bugs, and potentially
>> less-maintainable code.
>
>> (Note also that lxc-ls may be rewritten in python.  Is that a problem
>> for your use case?)
>
> Some reason?  Sorry.  In my "day job" I have to maintain code written in
> C, bash, sh, ash (I wrote and array function library for ash and
> busybox), perl and python, including a raft of stuff that interfaces to
> web scrappers and SQL databases.  My team and I find python to be the
> least maintainable and all the cruft that our predecessors wrote in
> python is getting rewritten in perl so it can be maintained as soon as
> we figure out what the hell they did in there...  We had one guy who was
> absolutely in love with python and django and left us with a mess.  Now,
> that may well be his fault to begin with being that it is uncommented
> highly recursive web processing code (yes it uses "beautiful soup") that
> drives us all nuts and breaks with nothing more that the classical
> python backtrace.  I know a lot of people are just in love with python
> but I wouldn't just rewrite it unless there was a really good reason to.

The reason is that we have API bindings in python which let us directly
access any function from the C API instead of having to do wild guess
from the shell scripts or limit the possible features as is done currently.

In my experience, the readability of the code has little to do with the
language, it tends to have a lot more to do with who wrote the code to
being with ;)

>>> Would you be prepared for minor sacrifices to use posix compliant shell
>>> scripts?
>
>> Someone else can jump in if they object, but I personally don't.  Are
>> you willing to subscribe to github.com/lxc/lxc#staging commits and
>> watch for new commits re-breaking posix compliance?
>
> Converting from bash to ash (which is very sh like) isn't too bad if you
> are not making extensive use of arrays and string functions.  It's
> probably doable (having done it myself with some fairly sophisticated
> bash scripts dealing with LUKS encryption and file systems).  I would
> start by trying to run it under busybox ash and see what breaks.

The target really should be pure POSIX shell and nothing else, this will
guarantee that the code will work on the standard shells like busybox's
sh, Debian's dash and the good old bash.

The checkbashisms command can be used to spot any of the usual bashims
(once the script has been changed to use #!/bin/sh).

>> Successful runs of https://code.launchpad.net/~serge-hallyn/+junk/lxc-test
>> with your patches will also be reassuring.
>
>> -serge
>
> Regards,
> Mike
>
>
>
> ------------------------------------------------------------------------------
> 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

------------------------------

Message: 5
Date: Wed, 14 Nov 2012 21:14:02 +0100
From: Natanael Copa <ncopa at alpinelinux.org>
Subject: Re: [lxc-devel] [PATCH] lxc-destroy: make it work with
        busybox
To: Serge Hallyn <serge.hallyn at canonical.com>
Cc: lxc-devel at lists.sourceforge.net
Message-ID: <20121114211402.7cec17f2 at ncopa-laptop.res.nor.wtbts.net>
Content-Type: text/plain; charset=US-ASCII

On Wed, 14 Nov 2012 08:51:07 -0600
Serge Hallyn <serge.hallyn at canonical.com> wrote:

> Quoting Natanael Copa (ncopa at alpinelinux.org):
> > Busybox 'rm' has no support for --one-file-system. We can make it
> > work on busybox with find ... -xdev.
>
> Hm, well it does slow it down a smidgeon, but no real objection
> from me.  Still let's if anyone else has a comment.

Why does it slow down? Did you test it?

-nc



------------------------------

Message: 6
Date: Wed, 14 Nov 2012 21:18:48 +0100
From: Natanael Copa <ncopa at alpinelinux.org>
Subject: Re: [lxc-devel] [PATCH] lxc-start: add option -p,
        --pidfile=FILE for use with --daemon
To: Serge Hallyn <serge.hallyn at canonical.com>
Cc: lxc-devel at lists.sourceforge.net
Message-ID: <20121114211848.66ea0e7a at ncopa-laptop.res.nor.wtbts.net>
Content-Type: text/plain; charset=US-ASCII

On Wed, 14 Nov 2012 08:44:41 -0600
Serge Hallyn <serge.hallyn at canonical.com> wrote:

> Quoting Natanael Copa (ncopa at alpinelinux.org):
> > Add option to create a pidfile for lxc-start daemon. This is helpful
> > for init scripts and process monitors.
>
> Why only when daemonizing?  Someone could presumably first lxc-start
> by hand in the foreground, then another admin walks in and restarts
> the sysvinit lxc job?

I assume 'someone' starting with lxc-start instead of via sysvinit (or
any other init) would not think of appening --pidfile option, but sure,
I think you have a valid point. I'll prepare a new patch.

-nc



------------------------------

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


End of Lxc-devel Digest, Vol 51, Issue 10
*****************************************






More information about the lxc-devel mailing list