[lxc-devel] [PATCH v2] lxc-checkconfig: use POSIX shell instead of bash

2012-11-26 Thread Natanael Copa
- replace 'echo -e' with printf - replace 'if [[ ... ]]' with 'if [ ... ]' - add \ at after && and || when those are at end of line Signed-off-by: Natanael Copa --- Changes v1 -> v2: - rebase against current staging src/lxc/lxc-checkconfig.in | 32 1 file chang

[lxc-devel] [PATCH v2] lxc-version: use POSIX shell instead of bash

2012-11-26 Thread Natanael Copa
There is no reason to depend on bash for a single echo. Signed-off-by: Natanael Copa --- Changes v1 -> v2: - add signed-off-by src/lxc/lxc-version.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc-version.in b/src/lxc/lxc-version.in index 1bd055a..b6875da 10064

[lxc-devel] [PATCH] lxc-setuid: use POSIX shell instead of bash

2012-11-26 Thread Natanael Copa
Avoid getop --longoptions. Signed-off-by: Natanael Copa --- src/lxc/lxc-setuid.in | 34 +- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/lxc/lxc-setuid.in b/src/lxc/lxc-setuid.in index 84f18af..e6a7b96 100644 --- a/src/lxc/lxc-setuid.in +++ b

[lxc-devel] [PATCH] lxc-setcap: use POSIX shell instead of bash

2012-11-26 Thread Natanael Copa
Avoid getopt --longoptions Signed-off-by: Natanael Copa --- src/lxc/lxc-setcap.in | 34 +- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/lxc/lxc-setcap.in b/src/lxc/lxc-setcap.in index 7fd390c..02c1e09 100644 --- a/src/lxc/lxc-setcap.in +++ b

[lxc-devel] [PATCH] lxc-version: use POSIX shell instead of bash

2012-11-26 Thread Natanael Copa
There is no reason to depend on bash for a single echo. --- Should we move this to lxc-info --version? src/lxc/lxc-version.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc-version.in b/src/lxc/lxc-version.in index 1bd055a..b6875da 100644 --- a/src/lxc/lxc-version

[lxc-devel] [PATCH] Use autoconf LXCPATH instead of hardcoded LXCDIR

2012-11-26 Thread Dwight Engen
LXCDIR is only used in lxc_container_new, whereas LXCPATH is used throughout the rest of lxc, and even in the same file as lxc_container_new (for example create_container_dir()). Signed-off-by: Dwight Engen --- src/lxc/lxccontainer.c |6 +++--- src/lxc/lxccontainer.h |1 - 2 files change

[lxc-devel] [PATCH] Make config api items const

2012-11-26 Thread Dwight Engen
This makes it easier to write a binding, and presents a cleaner API. Use strdupa in a few places to get mutable strings for tokenizing / parsing. Also change the argv type in lxcapi_start and lxcapi_create to match that of execv(3). Signed-off-by: Dwight Engen --- src/lxc/conf.c | 10 +

Re: [lxc-devel] [PATCH 1/1] fix lxc-ubuntu-cloud option parsing bugs

2012-11-26 Thread Stéphane Graber
On 11/26/2012 03:08 PM, Serge Hallyn wrote: > The -u shortopt matching --userdata was not specified, and when -L > is found shift should have been by 1 not 2 since there is no optarg. > > Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber Pushed to staging. Thanks > --- > templates/lxc-ub

[lxc-devel] [PATCH 1/1] fix lxc-ubuntu-cloud option parsing bugs

2012-11-26 Thread Serge Hallyn
The -u shortopt matching --userdata was not specified, and when -L is found shift should have been by 1 not 2 since there is no optarg. Signed-off-by: Serge Hallyn --- templates/lxc-ubuntu-cloud.in |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/lxc-ubuntu-cl

Re: [lxc-devel] [PATCH] lxc-info: add option -t, --state-is=STATE to test for a given test

2012-11-26 Thread Stéphane Graber
On 11/26/2012 02:25 PM, Serge Hallyn wrote: > Quoting Natanael Copa (nc...@alpinelinux.org): >> Add an option to test for a give state. This is useful for scripts. >> It lets us you do thing like: >> >> if lxc-info --name myname --state-is RUNNING; then >>... >> >> Signed-off-by: Natanael Copa

Re: [lxc-devel] [PATCH] lxc-info: add option -t, --state-is=STATE to test for a given test

2012-11-26 Thread Serge Hallyn
Quoting Natanael Copa (nc...@alpinelinux.org): > Add an option to test for a give state. This is useful for scripts. > It lets us you do thing like: > > if lxc-info --name myname --state-is RUNNING; then >... > > Signed-off-by: Natanael Copa Acked-by: Serge E. Hallyn > --- > src/lxc/lxc

[lxc-devel] [PATCH] lxc-info: add option -t, --state-is=STATE to test for a given test

2012-11-26 Thread Natanael Copa
Add an option to test for a give state. This is useful for scripts. It lets us you do thing like: if lxc-info --name myname --state-is RUNNING; then ... Signed-off-by: Natanael Copa --- src/lxc/lxc_info.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/s

Re: [lxc-devel] [PATCH] Ensure argv passed by createl to create is NULL terminated

2012-11-26 Thread Stéphane Graber
On 11/26/2012 01:10 PM, Serge Hallyn wrote: > Quoting Dwight Engen (dwight.en...@oracle.com): >> Signed-off-by: Dwight Engen > > Acked-by: Serge E. Hallyn Thanks, applied to staging. >> --- >> src/lxc/lxccontainer.c |3 ++- >> 1 files changed, 2 insertions(+), 1 deletions(-) >> >> diff --

Re: [lxc-devel] link /dev/kmsg to /dev/console in the container

2012-11-26 Thread William Dauchy
btw, I'm quite surprised to see such a patch between a rc2 and the final release. -- William -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, d

Re: [lxc-devel] [PATCH] Free allocated configuration memory

2012-11-26 Thread Stéphane Graber
On 11/26/2012 01:07 PM, Serge Hallyn wrote: > Quoting Dwight Engen (dwight.en...@oracle.com): >> Most of these were found with valgrind by repeatedly doing lxc_container_new >> followed by lxc_container_put. Also free memory when config items are >> re-parsed, as happens when lxcapi_set_config_item

Re: [lxc-devel] [PATCH] Ensure argv passed by createl to create is NULL terminated

2012-11-26 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com): > Signed-off-by: Dwight Engen Acked-by: Serge E. Hallyn > --- > src/lxc/lxccontainer.c |3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c > index 37f5ed7..4818b2c 10064

Re: [lxc-devel] [PATCH] Free allocated configuration memory

2012-11-26 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com): > Most of these were found with valgrind by repeatedly doing lxc_container_new > followed by lxc_container_put. Also free memory when config items are > re-parsed, as happens when lxcapi_set_config_item() is called. Refactored > path type config items

Re: [lxc-devel] [PATCH] Fix use of list item memory after free

2012-11-26 Thread Dwight Engen
On Mon, 26 Nov 2012 11:40:40 -0600 Serge Hallyn wrote: > Quoting Dwight Engen (dwight.en...@oracle.com): > > Valgrind showed use of ->next field after item has been free()ed. > > Introduce a lxc_list_for_each_safe() which allows traversal of a > > list when the body of the loop may remove the cur

[lxc-devel] lxc python binding

2012-11-26 Thread Dwight Engen
Hi Stéphane, While I was testing the lua binding I did (based largely on the Python one :) I noticed a memory leak when container objects were garbage collected, and I think the Python binding may have it as well. I think Container_dealloc() should probably do lxc_container_put() as shown in the p

Re: [lxc-devel] [PATCH] Fix use of list item memory after free

2012-11-26 Thread Stéphane Graber
On 11/26/2012 12:40 PM, Serge Hallyn wrote: > Quoting Dwight Engen (dwight.en...@oracle.com): >> Valgrind showed use of ->next field after item has been free()ed. >> Introduce a lxc_list_for_each_safe() which allows traversal of a list >> when the body of the loop may remove the currently iterated

Re: [lxc-devel] [PATCH] Fix fd leak in lxc log

2012-11-26 Thread Stéphane Graber
On 11/26/2012 12:38 PM, Serge Hallyn wrote: > Quoting Dwight Engen (dwight.en...@oracle.com): >> lxc_log_init will leak an fd when it is called by a long running >> program that may call lxc_container_new multiple times. Fix by >> only opening the log if it is not already open. >> >> Signed-off-by:

Re: [lxc-devel] link /dev/kmsg to /dev/console in the container

2012-11-26 Thread William Dauchy
Hi Serge, Thank you for you reply. On Mon, Nov 26, 2012 at 6:28 PM, Serge Hallyn wrote: > No, it's the kernel's. Patch for that is however not yet ready. > > Failure to set up kmsg should not fail container startup. Commit > f62b344996937459ae5f31b0358cb440ddde421f fixed that, but that is > ap

Re: [lxc-devel] [PATCH] Fix use of list item memory after free

2012-11-26 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com): > Valgrind showed use of ->next field after item has been free()ed. > Introduce a lxc_list_for_each_safe() which allows traversal of a list > when the body of the loop may remove the currently iterated item. > > Signed-off-by: Dwight Engen Thanks (

Re: [lxc-devel] [PATCH] Fix fd leak in lxc log

2012-11-26 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com): > lxc_log_init will leak an fd when it is called by a long running > program that may call lxc_container_new multiple times. Fix by > only opening the log if it is not already open. > > Signed-off-by: Dwight Engen Acked-by: Serge E. Hallyn > ---

Re: [lxc-devel] link /dev/kmsg to /dev/console in the container

2012-11-26 Thread Serge Hallyn
Quoting William Dauchy (wdau...@gmail.com): > Hello, > > I tried to update from lxc-0.8-rc2 to lxc-0.8. > > I don't understand this commit: 1bd051a > link /dev/kmsg to /dev/console in the container > > I don't see why lxc is doing this job. I'm using a read only rootfs > with an additional rw di

Re: [lxc-devel] [PATCH 3/3] gitignore: Ignore python cache

2012-11-26 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn > --- > .gitignore | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/.gitignore b/.gitignore > index 398e4fc..76c9533 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -65,6 +65,

Re: [lxc-devel] [PATCH 1/3] python: PEP8 compatibility

2012-11-26 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > The new version of the pep8 command is detecting more indentation > mistakes than it used to, this fixes them. > Every instance looks like bike-shedding to me, but ok. Acked-by: Serge E. Hallyn > Signed-off-by: Stéphane Graber > --- > src/lxc/

[lxc-devel] [PATCH] Free allocated configuration memory

2012-11-26 Thread Dwight Engen
Most of these were found with valgrind by repeatedly doing lxc_container_new followed by lxc_container_put. Also free memory when config items are re-parsed, as happens when lxcapi_set_config_item() is called. Refactored path type config items to use a common underlying routine. Signed-off-by: Dwi

[lxc-devel] [PATCH] Ensure argv passed by createl to create is NULL terminated

2012-11-26 Thread Dwight Engen
Signed-off-by: Dwight Engen --- src/lxc/lxccontainer.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 37f5ed7..4818b2c 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -683,13 +683,14 @@ static bo

[lxc-devel] [PATCH] Fix use of list item memory after free

2012-11-26 Thread Dwight Engen
Valgrind showed use of ->next field after item has been free()ed. Introduce a lxc_list_for_each_safe() which allows traversal of a list when the body of the loop may remove the currently iterated item. Signed-off-by: Dwight Engen --- src/lxc/conf.c| 38 +++--

[lxc-devel] [PATCH] Fix fd leak in lxc log

2012-11-26 Thread Dwight Engen
lxc_log_init will leak an fd when it is called by a long running program that may call lxc_container_new multiple times. Fix by only opening the log if it is not already open. Signed-off-by: Dwight Engen --- src/lxc/log.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a

[lxc-devel] Resource cleanups

2012-11-26 Thread Dwight Engen
Hello, Recently I wrote a lua binding for lxc on which I built a simple lxc-top tool. In testing that my container class was properly freeing all resources during garbage collection, I discovered that lxc itself needs some cleanups. I will be posting a series of patches to do these cleanups, which

Re: [lxc-devel] [PATCH 2/3] python: Use builtin len() function for network interfaces

2012-11-26 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > Use our own len() function for network interfaces as doing > len(container.get_config_item("lxc.network")) will fail when the > list is empty. > > Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn > --- > src/python-lxc/lxc/__init__.py |

[lxc-devel] link /dev/kmsg to /dev/console in the container

2012-11-26 Thread William Dauchy
Hello, I tried to update from lxc-0.8-rc2 to lxc-0.8. I don't understand this commit: 1bd051a link /dev/kmsg to /dev/console in the container I don't see why lxc is doing this job. I'm using a read only rootfs with an additional rw disk (e.g for the console); so the start is now broken because i

Re: [lxc-devel] [PATCH] Fix checkconfig to handle kernel memory cgroup name change

2012-11-26 Thread Stéphane Graber
On 11/14/2012 12:03 PM, Dwight Engen wrote: > 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 Sorry for the delay, I somehow missed that one. Acked-by: Stéphane Graber Pus

[lxc-devel] [PATCH 3/3] gitignore: Ignore python cache

2012-11-26 Thread Stéphane Graber
Signed-off-by: Stéphane Graber --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 398e4fc..76c9533 100644 --- a/.gitignore +++ b/.gitignore @@ -65,6 +65,8 @@ src/lxc/lxc-unshare src/lxc/lxc-version src/lxc/lxc-wait +src/python-lxc/lxc/__pycache_

[lxc-devel] [PATCH 0/3] Various python fixes

2012-11-26 Thread Stéphane Graber
PEP-8 and other bugfixes for the python code. Stéphane Graber (3): python: PEP8 compatibility python: Use builtin len() function for network interfaces gitignore: Ignore python cache .gitignore | 2 + src/lxc/lxc-start-ephemeral.in | 81 +++---

[lxc-devel] [PATCH 1/3] python: PEP8 compatibility

2012-11-26 Thread Stéphane Graber
The new version of the pep8 command is detecting more indentation mistakes than it used to, this fixes them. Signed-off-by: Stéphane Graber --- src/lxc/lxc-start-ephemeral.in | 81 +++-- src/python-lxc/examples/api_test.py | 20 - src/python-lxc/lxc/_

[lxc-devel] [PATCH 2/3] python: Use builtin len() function for network interfaces

2012-11-26 Thread Stéphane Graber
Use our own len() function for network interfaces as doing len(container.get_config_item("lxc.network")) will fail when the list is empty. Signed-off-by: Stéphane Graber --- src/python-lxc/lxc/__init__.py | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pyth

Re: [lxc-devel] [PATCH] Add lxc.autodev (v2)

2012-11-26 Thread Stéphane Graber
On 11/23/2012 03:16 PM, Serge Hallyn wrote: > Add a container config option to mount and populate /dev in a container. > > We might want to add options to specify a max size for /dev other than > the default 100k, and to specify other devices to create. And maybe > someone can think of a better n

Re: [lxc-devel] [PATCH 1/2] python: Add add_device() function

2012-11-26 Thread Stéphane Graber
On 11/23/2012 03:19 PM, Serge Hallyn wrote: > Quoting Stéphane Graber (stgra...@ubuntu.com): >>> The cgroup tweaking should be done using generic code. Maybe it's >>> time to add those to the c api... >> >> Totally agreed, I was actually going to nag you again this cycle about >> getting a set_cgr

Re: [lxc-devel] [PATCH] lxc-create: fix passing over first argument to template script

2012-11-26 Thread Stéphane Graber
On 11/22/2012 08:16 AM, Natanael Copa wrote: > The e60a8164c12d565f70071ff6b32b823dd495df9e introduced a bug that caused > first argument passed over to the template script get lost. > > This patch fixes it. > > Signed-off-by: Natanael Copa > --- > src/lxc/lxc-create.in | 1 - > 1 file changed,

Re: [lxc-devel] [PATCH] lxc-create: do not use 'local'

2012-11-26 Thread Stéphane Graber
On 11/26/2012 06:00 AM, Natanael Copa wrote: > Apparently 'local' is not POSIX. Don't use it. > > Signed-off-by: Natanael Copa Acked-by: Stéphane Graber Applied to staging branch. Thanks. > --- > src/lxc/lxc-create.in | 7 +++ > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff -

[lxc-devel] [PATCH] lxc-create: do not use 'local'

2012-11-26 Thread Natanael Copa
Apparently 'local' is not POSIX. Don't use it. Signed-off-by: Natanael Copa --- src/lxc/lxc-create.in | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in index 26ec6a2..30f0c22 100644 --- a/src/lxc/lxc-create.in +++ b/src/lxc/l