Re: [lxc-devel] [PATCH] python: Update to the device related functions

2012-12-04 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > This commit does the following changes to the python API: > - Rename the add_device API call to add_device_node > - Adds an extra check that the container is running to add_device_node > - Introduces a new add_device_net function > > And the foll

[lxc-devel] [PATCH] lxc-ls: Update code to allow non-root listing

2012-12-04 Thread Stéphane Graber
Re-arrange the code so that we only grab the container object when doing something more than building a simple list of existing containers. This means that now the following calls can run unprivileged: - lxc-ls - lxc-ls -1 Everything else will still require root privileges. Signed-off-by: Stép

[lxc-devel] [PATCH] python: Update to the device related functions

2012-12-04 Thread Stéphane Graber
This commit does the following changes to the python API: - Rename the add_device API call to add_device_node - Adds an extra check that the container is running to add_device_node - Introduces a new add_device_net function And the following changes to the lxc-device tool: - Change parser setu

Re: [lxc-devel] [PATCH 2/3] lxc-ls: Show a simple error message when non-root

2012-12-04 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > On 12/04/2012 04:34 PM, Serge Hallyn wrote: > > Quoting Stéphane Graber (stgra...@ubuntu.com): > >> Instead of returning a python stacktrace, check what the current euid is > >> and show an argparse error message similar to that used in > >> lxc-sta

Re: [lxc-devel] [PATCH 2/3] lxc-ls: Show a simple error message when non-root

2012-12-04 Thread Stéphane Graber
On 12/04/2012 04:34 PM, Serge Hallyn wrote: > Quoting Stéphane Graber (stgra...@ubuntu.com): >> Instead of returning a python stacktrace, check what the current euid is >> and show an argparse error message similar to that used in >> lxc-start-ephemeral. >> >> Signed-off-by: Stéphane Graber > >

Re: [lxc-devel] [PATCH 3/3] lxc-device: Show an error message when non-root

2012-12-04 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > Instead of returning a python stacktrace, check what the current euid is > and show an argparse error message similar to that used in > lxc-start-ephemeral. > > Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn > --- > src/lxc/lxc-devic

Re: [lxc-devel] [PATCH 2/3] lxc-ls: Show a simple error message when non-root

2012-12-04 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > Instead of returning a python stacktrace, check what the current euid is > and show an argparse error message similar to that used in > lxc-start-ephemeral. > > Signed-off-by: Stéphane Graber Wait, you must be root to call lxc-ls at all? > --- >

Re: [lxc-devel] [PATCH 1/3] lxc-start-ephemeral: Use argparse errors

2012-12-04 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > Use argparse's error function instead of our own print + exit. > > Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn > --- > src/lxc/lxc-start-ephemeral.in | 11 --- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --g

[lxc-devel] [PATCH 1/3] lxc-start-ephemeral: Use argparse errors

2012-12-04 Thread Stéphane Graber
Use argparse's error function instead of our own print + exit. Signed-off-by: Stéphane Graber --- src/lxc/lxc-start-ephemeral.in | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/lxc/lxc-start-ephemeral.in b/src/lxc/lxc-start-ephemeral.in index ccf6059..e11919f

[lxc-devel] [PATCH 0/3] Make python scripts deal better when non-root

2012-12-04 Thread Stéphane Graber
The LXC API currently doesn't work terribly well when the user isn't root for a variety of reasons. The python binding therfore immediately returns an exception if a non-root user tries to access a container object (as the C calls would fail anyway). These commits update the various python script

[lxc-devel] [PATCH 3/3] lxc-device: Show an error message when non-root

2012-12-04 Thread Stéphane Graber
Instead of returning a python stacktrace, check what the current euid is and show an argparse error message similar to that used in lxc-start-ephemeral. Signed-off-by: Stéphane Graber --- src/lxc/lxc-device | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/lxc/lxc-device b/src/lxc/lx

[lxc-devel] [PATCH 2/3] lxc-ls: Show a simple error message when non-root

2012-12-04 Thread Stéphane Graber
Instead of returning a python stacktrace, check what the current euid is and show an argparse error message similar to that used in lxc-start-ephemeral. Signed-off-by: Stéphane Graber --- src/lxc/lxc-ls | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/lxc/lxc-ls b/src/lxc/lxc-ls in

Re: [lxc-devel] [PATCH] make install should create $LXCPATH directory

2012-12-04 Thread Stéphane Graber
On 11/29/2012 04:24 PM, Dwight Engen wrote: > The $LXCPATH (default /var/lib/lxc) directory was not being created by > make install, so unless it gets created by some other means > (packaging tools), commands such as lxc-create will fail. > > Signed-off-by: Dwight Engen Acked-by: Stéphane Graber

Re: [lxc-devel] [PATCH] rename physical nics at shutdown

2012-12-04 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > > @@ -134,9 +133,12 @@ int lxc_execute(const char *name, char *const argv[], > > int quiet, > > .argv = argv, > > .quiet = quiet > > }; > > + int ret; > > > > if (lxc_check_inherited(conf, -1)) > > ret

Re: [lxc-devel] [PATCH] rename physical nics at shutdown

2012-12-04 Thread Stéphane Graber
On 12/04/2012 01:19 PM, Serge Hallyn wrote: > When a physical nic is being set up, store its ifindex and original name > in struct lxc_conf. At reboot, reset the original name. > We can't just go over the original network list in lxc_conf at shutdown > because that may be tweaked in the meantime t

Re: [lxc-devel] [PATCH] Install legacy scripts when built without python.

2012-12-04 Thread Stéphane Graber
On 12/04/2012 12:35 PM, Serge Hallyn wrote: > Quoting Stéphane Graber (stgra...@ubuntu.com): >> Re-introduce the old lxc-ls script and manpage under a new legacy >> sub-directory. >> >> Those will be installed in place of their python equivalent when LXC >> is built without --enable-python. >> >> A

Re: [lxc-devel] [PATCH] Rewrite lxc-ls in python

2012-12-04 Thread Stéphane Graber
On 12/03/2012 09:01 PM, Serge Hallyn wrote: > Quoting Stéphane Graber (stgra...@ubuntu.com): >> This rewrite is mostly compatible with the shell version. >> --active and -1 still work and behave as they used to. >> >> This adds --running, --stopped and --frozen as state filters. >> >> A new "fancy"

[lxc-devel] [PATCH] rename physical nics at shutdown

2012-12-04 Thread Serge Hallyn
When a physical nic is being set up, store its ifindex and original name in struct lxc_conf. At reboot, reset the original name. We can't just go over the original network list in lxc_conf at shutdown because that may be tweaked in the meantime through the C api. The saved_nics list is only setup

Re: [lxc-devel] [PATCH RFC] lxc_conf logfile and loglevel support

2012-12-04 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > On 12/03/2012 08:41 PM, Serge Hallyn wrote: > > Add 'lxc.logfile' and 'lxc.loglevel' config items. Values provided on > > the command line override the config items. > > > > Have lxccontainer not set a default loglevel and logfile. > > > > Signed-

Re: [lxc-devel] [PATCH] Install legacy scripts when built without python.

2012-12-04 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > Re-introduce the old lxc-ls script and manpage under a new legacy > sub-directory. > > Those will be installed in place of their python equivalent when LXC > is built without --enable-python. > > Any other script ported to python should be added to

Re: [lxc-devel] [PATCH 2/2] templates: use hardlink detection in rsync

2012-12-04 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com): > On Mon, 3 Dec 2012 21:25:00 -0600 > Serge Hallyn wrote: > > > Quoting Michael H. Warfield (m...@wittsend.com): > > > On Mon, 2012-12-03 at 20:43 -0600, Serge Hallyn wrote: > > > > A-ha, actually busybox cp does not support -T, at least here on > >

[lxc-devel] [PATCH] Install legacy scripts when built without python.

2012-12-04 Thread Stéphane Graber
Re-introduce the old lxc-ls script and manpage under a new legacy sub-directory. Those will be installed in place of their python equivalent when LXC is built without --enable-python. Any other script ported to python should be added to those lists. Signed-off-by: Stéphane Graber --- .gitignor

Re: [lxc-devel] [PATCH RFC] lxc_conf logfile and loglevel support

2012-12-04 Thread Stéphane Graber
On 12/03/2012 08:41 PM, Serge Hallyn wrote: > Add 'lxc.logfile' and 'lxc.loglevel' config items. Values provided on > the command line override the config items. > > Have lxccontainer not set a default loglevel and logfile. > > Signed-off-by: Serge Hallyn Haven't tested it but the code matches

Re: [lxc-devel] [PATCH 2/2] templates: use hardlink detection in rsync

2012-12-04 Thread Dwight Engen
On Mon, 3 Dec 2012 21:25:00 -0600 Serge Hallyn wrote: > Quoting Michael H. Warfield (m...@wittsend.com): > > On Mon, 2012-12-03 at 20:43 -0600, Serge Hallyn wrote: > > > A-ha, actually busybox cp does not support -T, at least here on > > > ubuntu 12.10. So should we go with rsync -ah after all s