Re: [lxc-devel] Linux Plumbers 2013 - Container mini-summit, (hopefully) final schedule

2013-09-18 Thread Claudio Kuenzler
On Tue, Sep 17, 2013 at 3:01 AM, Stéphane Graber wrote:

> Hey everyone,
>
> So I just went through everything the other track leads accepted over
> the past couple of weeks and split the remaining time as well as
> (unfortunately) reduced some of the current time allocation for some of
> the talks.
>
>
> Should anyone have any question, can't make it or need more time, please
> let me know ASAP. I'll be travelling to New Orleans tomorrow but the
> mini-summit is only on Thursday so we can only do some more last minute
> tweaks to the schedule.
>
> Thanks and see you all there!
>

Hi Stéphane,
I'm not sure if this was already asked or not, but will the mini-summit be
recorded and published?
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


Re: [lxc-devel] Linux Plumbers 2013 - Container mini-summit, (hopefully) final schedule

2013-09-18 Thread Stéphane Graber
On Wed, Sep 18, 2013 at 09:30:28AM +0200, Claudio Kuenzler wrote:
> On Tue, Sep 17, 2013 at 3:01 AM, Stéphane Graber wrote:
> 
> > Hey everyone,
> >
> > So I just went through everything the other track leads accepted over
> > the past couple of weeks and split the remaining time as well as
> > (unfortunately) reduced some of the current time allocation for some of
> > the talks.
> >
> >
> > Should anyone have any question, can't make it or need more time, please
> > let me know ASAP. I'll be travelling to New Orleans tomorrow but the
> > mini-summit is only on Thursday so we can only do some more last minute
> > tweaks to the schedule.
> >
> > Thanks and see you all there!
> >
> 
> Hi Stéphane,
> I'm not sure if this was already asked or not, but will the mini-summit be
> recorded and published?

Hi,

It's not clear. I heard that at least some would be recorded and
available later, I hope it'll be the case for ours but I can't promise
anything as that's entirely up to Plumbers.

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com


signature.asc
Description: Digital signature
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] [lxc/lxc] 025ed0: make heavier use of process_lock (v2)

2013-09-18 Thread GitHub
  Branch: refs/heads/staging
  Home:   https://github.com/lxc/lxc
  Commit: 025ed0f3911836b71f498d8368725c77a7e1932a
  https://github.com/lxc/lxc/commit/025ed0f3911836b71f498d8368725c77a7e1932a
  Author: Serge Hallyn 
  Date:   2013-09-18 (Wed, 18 Sep 2013)

  Changed paths:
M src/lxc/af_unix.c
M src/lxc/apparmor.c
M src/lxc/attach.c
M src/lxc/bdev.c
M src/lxc/caps.c
M src/lxc/cgroup.c
M src/lxc/commands.c
M src/lxc/conf.c
M src/lxc/console.c
M src/lxc/freezer.c
M src/lxc/log.c
M src/lxc/lxccontainer.c
M src/lxc/lxclock.c
M src/lxc/lxclock.h
M src/lxc/lxcutmp.c
M src/lxc/mainloop.c
M src/lxc/monitor.c
M src/lxc/network.c
M src/lxc/nl.c
M src/lxc/parse.c
M src/lxc/seccomp.c
M src/lxc/start.c
M src/lxc/state.c
M src/lxc/sync.c
M src/lxc/utils.c

  Log Message:
  ---
  make heavier use of process_lock (v2)

pthread_mutex_lock() will only return an error if it was set to
PTHREAD_MUTEX_ERRORCHECK and we are recursively calling it (and
would otherwise have deadlocked).  If that's the case then log a
message for future debugging and exit.  Trying to "recover" is
nonsense at that point.

process_lock() was held over too long a time in lxcapi_start()
in the daemonize case.  (note the non-daemonized case still needs a
check to enforce that it must NOT be called while threaded).  Add
process_lock() at least across all open/close/socket() calls.

Anything done after a fork() doesn't need the locks as it is no
longer threaded - so some open/close/dups()s are not locked for
that reason.  However, some common functions are called from both
threaded and non-threaded contexts.  So after doing a fork(), do
a possibly-extraneous process_unlock() to make sure that, if we
were forked while pthread mutex was held, we aren't deadlocked by
nobody.

Tested that lp:~serge-hallyn/+junk/lxc-test still works with this
patch.

Signed-off-by: Serge Hallyn 
Tested-by: S.Çağlar Onur 
Acked-by: Stéphane Graber 



--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


Re: [lxc-devel] [PATCH] Add get_interfaces to the API - v3

2013-09-18 Thread Stéphane Graber
On Mon, Sep 16, 2013 at 05:01:11PM -0400, S.Çağlar Onur wrote:
> get_ips accepts an interface name as a parameter but there was no
> way to get the interfaces names from the container. This patch
> introduces a new get_interfaces call to the API so that users
> can obtain the name of the interfaces.
> 
> Support for python bindings also introduced as a part of this version.
> 
> Signed-off-by: S.Çağlar Onur 

Acked-by: Stéphane Graber 

> ---
>  src/lxc/lxccontainer.c  | 129 
> ++--
>  src/lxc/lxccontainer.h  |   3 +
>  src/lxc/utils.c |  22 +-
>  src/lxc/utils.h |   1 +
>  src/python-lxc/examples/api_test.py |   5 ++
>  src/python-lxc/lxc.c|  60 +++--
>  src/python-lxc/lxc/__init__.py  |   8 +++
>  7 files changed, 189 insertions(+), 39 deletions(-)
> 
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index 79237df..8621cd8 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -1179,23 +1179,26 @@ static bool lxcapi_clear_config_item(struct 
> lxc_container *c, const char *key)
>   return ret == 0;
>  }
>  
> -char** lxcapi_get_ips(struct lxc_container *c, char* interface, char* 
> family, int scope)
> -{
> - int count = 0;
> - struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
> - char addressOutputBuffer[INET6_ADDRSTRLEN];
> - void *tempAddrPtr = NULL;
> - char **addresses = NULL, **temp;
> - char *address = NULL;
> +static inline void exit_from_ns(struct lxc_container *c, int *old_netns, int 
> *new_netns) {
> + /* Switch back to original netns */
> + if (*old_netns >= 0 && setns(*old_netns, CLONE_NEWNET))
> + SYSERROR("failed to setns");
> + if (*new_netns >= 0)
> + close(*new_netns);
> + if (*old_netns >= 0)
> + close(*old_netns);
> +}
> +
> +static inline bool enter_to_ns(struct lxc_container *c, int *old_netns, int 
> *new_netns) {
> + int ret = 0;
>   char new_netns_path[MAXPATHLEN];
> - int old_netns = -1, new_netns = -1, ret = 0;
>  
>   if (!c->is_running(c))
>   goto out;
>  
>   /* Save reference to old netns */
> - old_netns = open("/proc/self/ns/net", O_RDONLY);
> - if (old_netns < 0) {
> + *old_netns = open("/proc/self/ns/net", O_RDONLY);
> + if (*old_netns < 0) {
>   SYSERROR("failed to open /proc/self/ns/net");
>   goto out;
>   }
> @@ -1205,16 +1208,91 @@ char** lxcapi_get_ips(struct lxc_container *c, char* 
> interface, char* family, in
>   if (ret < 0 || ret >= MAXPATHLEN)
>   goto out;
>  
> - new_netns = open(new_netns_path, O_RDONLY);
> - if (new_netns < 0) {
> + *new_netns = open(new_netns_path, O_RDONLY);
> + if (*new_netns < 0) {
>   SYSERROR("failed to open %s", new_netns_path);
>   goto out;
>   }
>  
> - if (setns(new_netns, CLONE_NEWNET)) {
> + if (setns(*new_netns, CLONE_NEWNET)) {
>   SYSERROR("failed to setns");
>   goto out;
>   }
> + return true;
> +out:
> + exit_from_ns(c, old_netns, new_netns);
> + return false;
> +}
> +
> +static char** lxcapi_get_interfaces(struct lxc_container *c)
> +{
> + int count = 0, i;
> + bool found = false;
> + struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
> + char **interfaces = NULL, **temp;
> + int old_netns = -1, new_netns = -1;
> +
> + if (!enter_to_ns(c, &old_netns, &new_netns))
> + goto out;
> +
> + /* Grab the list of interfaces */
> + if (getifaddrs(&interfaceArray)) {
> + SYSERROR("failed to get interfaces list");
> + goto out;
> + }
> +
> + /* Iterate through the interfaces */
> + for (tempIfAddr = interfaceArray; tempIfAddr != NULL; tempIfAddr = 
> tempIfAddr->ifa_next) {
> + /*
> +  * WARNING: Following "for" loop does a linear search over the 
> interfaces array
> +  * For the containers with lots of interfaces this may be 
> problematic.
> + * I'm not expecting this to be the common usage but if it turns out 
> to be
> +  * than using binary search or a hash table could be more 
> elegant solution.
> +  */
> + for (i = 0; i < count; i++) {
> + if (strcmp(interfaces[i], tempIfAddr->ifa_name) == 0) {
> + found = true;
> + break;
> + }
> + }
> +
> + if (!found) {
> + count += 1;
> + temp = realloc(interfaces, count * sizeof(*interfaces));
> + if (!temp) {
> + count -= 1;
> + goto out;
> + }
> + interfaces = temp;
> + interfaces[count -

[lxc-devel] [PATCH trivial] lxc-create: add -P to --lxcpath option help text

2013-09-18 Thread Serge Hallyn
Signed-off-by: Serge Hallyn 
---
 src/lxc/lxc_create.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/lxc/lxc_create.c b/src/lxc/lxc_create.c
index ab5886b..4f205e8 100644
--- a/src/lxc/lxc_create.c
+++ b/src/lxc/lxc_create.c
@@ -120,22 +120,22 @@ static struct lxc_arguments my_args = {
 lxc-create creates a container\n\
 \n\
 Options :\n\
-  -n, --name=NAME   NAME for name of the container\n\
-  -f, --config=file initial configuration file\n\
-  -t, --template=t  template to use to setup container\n\
-  -B, --bdev=BDEV   backing store type to use\n\
-  --lxcpath=PATHplace container under PATH\n\
-  --lvname=LVNAME   Use LVM lv name LVNAME\n\
-(Default: container name)\n\
-  --vgname=VG   Use LVM vg called VG\n\
-(Default: lxc))\n\
-  --fstype=TYPE Create fstype TYPE\n\
-(Default: ext3))\n\
-  --fssize=SIZE Create filesystem of size SIZE\n\
-(Default: 1G))\n\
-  --dir=DIR Place rootfs directory under DIR\n\
-  --zfsroot=PATHCreate zfs under given zfsroot\n\
-(Default: tank/lxc))\n",
+  -n, --name=NAMENAME for name of the container\n\
+  -f, --config=file  Initial configuration file\n\
+  -t, --template=t   Template to use to setup container\n\
+  -B, --bdev=BDEVBacking store type to use\n\
+  -P, --lxcpath=PATH Place container under PATH\n\
+  --lvname=LVNAMEUse LVM lv name LVNAME\n\
+ (Default: container name)\n\
+  --vgname=VGUse LVM vg called VG\n\
+ (Default: lxc))\n\
+  --fstype=TYPE  Create fstype TYPE\n\
+ (Default: ext3))\n\
+  --fssize=SIZE  Create filesystem of size SIZE\n\
+ (Default: 1G))\n\
+  --dir=DIR  Place rootfs directory under DIR\n\
+  --zfsroot=PATH Create zfs under given zfsroot\n\
+ (Default: tank/lxc))\n",
.options  = my_longopts,
.parser   = my_parser,
.checker  = NULL,
-- 
1.8.1.2


--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


Re: [lxc-devel] [PATCH] Add get_interfaces to the API - v3

2013-09-18 Thread S . Çağlar Onur
Do you want me to sync this on top of staging and re-send?I think they are
conflicting right now.


On Wed, Sep 18, 2013 at 2:47 PM, Stéphane Graber wrote:

> On Mon, Sep 16, 2013 at 05:01:11PM -0400, S.Çağlar Onur wrote:
> > get_ips accepts an interface name as a parameter but there was no
> > way to get the interfaces names from the container. This patch
> > introduces a new get_interfaces call to the API so that users
> > can obtain the name of the interfaces.
> >
> > Support for python bindings also introduced as a part of this version.
> >
> > Signed-off-by: S.Çağlar Onur 
>
> Acked-by: Stéphane Graber 
>
> > ---
> >  src/lxc/lxccontainer.c  | 129
> ++--
> >  src/lxc/lxccontainer.h  |   3 +
> >  src/lxc/utils.c |  22 +-
> >  src/lxc/utils.h |   1 +
> >  src/python-lxc/examples/api_test.py |   5 ++
> >  src/python-lxc/lxc.c|  60 +++--
> >  src/python-lxc/lxc/__init__.py  |   8 +++
> >  7 files changed, 189 insertions(+), 39 deletions(-)
> >
> > diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> > index 79237df..8621cd8 100644
> > --- a/src/lxc/lxccontainer.c
> > +++ b/src/lxc/lxccontainer.c
> > @@ -1179,23 +1179,26 @@ static bool lxcapi_clear_config_item(struct
> lxc_container *c, const char *key)
> >   return ret == 0;
> >  }
> >
> > -char** lxcapi_get_ips(struct lxc_container *c, char* interface, char*
> family, int scope)
> > -{
> > - int count = 0;
> > - struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
> > - char addressOutputBuffer[INET6_ADDRSTRLEN];
> > - void *tempAddrPtr = NULL;
> > - char **addresses = NULL, **temp;
> > - char *address = NULL;
> > +static inline void exit_from_ns(struct lxc_container *c, int
> *old_netns, int *new_netns) {
> > + /* Switch back to original netns */
> > + if (*old_netns >= 0 && setns(*old_netns, CLONE_NEWNET))
> > + SYSERROR("failed to setns");
> > + if (*new_netns >= 0)
> > + close(*new_netns);
> > + if (*old_netns >= 0)
> > + close(*old_netns);
> > +}
> > +
> > +static inline bool enter_to_ns(struct lxc_container *c, int *old_netns,
> int *new_netns) {
> > + int ret = 0;
> >   char new_netns_path[MAXPATHLEN];
> > - int old_netns = -1, new_netns = -1, ret = 0;
> >
> >   if (!c->is_running(c))
> >   goto out;
> >
> >   /* Save reference to old netns */
> > - old_netns = open("/proc/self/ns/net", O_RDONLY);
> > - if (old_netns < 0) {
> > + *old_netns = open("/proc/self/ns/net", O_RDONLY);
> > + if (*old_netns < 0) {
> >   SYSERROR("failed to open /proc/self/ns/net");
> >   goto out;
> >   }
> > @@ -1205,16 +1208,91 @@ char** lxcapi_get_ips(struct lxc_container *c,
> char* interface, char* family, in
> >   if (ret < 0 || ret >= MAXPATHLEN)
> >   goto out;
> >
> > - new_netns = open(new_netns_path, O_RDONLY);
> > - if (new_netns < 0) {
> > + *new_netns = open(new_netns_path, O_RDONLY);
> > + if (*new_netns < 0) {
> >   SYSERROR("failed to open %s", new_netns_path);
> >   goto out;
> >   }
> >
> > - if (setns(new_netns, CLONE_NEWNET)) {
> > + if (setns(*new_netns, CLONE_NEWNET)) {
> >   SYSERROR("failed to setns");
> >   goto out;
> >   }
> > + return true;
> > +out:
> > + exit_from_ns(c, old_netns, new_netns);
> > + return false;
> > +}
> > +
> > +static char** lxcapi_get_interfaces(struct lxc_container *c)
> > +{
> > + int count = 0, i;
> > + bool found = false;
> > + struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
> > + char **interfaces = NULL, **temp;
> > + int old_netns = -1, new_netns = -1;
> > +
> > + if (!enter_to_ns(c, &old_netns, &new_netns))
> > + goto out;
> > +
> > + /* Grab the list of interfaces */
> > + if (getifaddrs(&interfaceArray)) {
> > + SYSERROR("failed to get interfaces list");
> > + goto out;
> > + }
> > +
> > + /* Iterate through the interfaces */
> > + for (tempIfAddr = interfaceArray; tempIfAddr != NULL; tempIfAddr =
> tempIfAddr->ifa_next) {
> > + /*
> > +  * WARNING: Following "for" loop does a linear search over
> the interfaces array
> > +  * For the containers with lots of interfaces this may be
> problematic.
> > + * I'm not expecting this to be the common usage but if it
> turns out to be
> > +  * than using binary search or a hash table could be
> more elegant solution.
> > +  */
> > + for (i = 0; i < count; i++) {
> > + if (strcmp(interfaces[i], tempIfAddr->ifa_name) ==
> 0) {
> > + found = true;
> > + break;
> > + }
> > + }
> > +
> > + 

[lxc-devel] [PATCH] Add get_interfaces to the API - v4

2013-09-18 Thread S . Çağlar Onur
get_ips accepts an interface name as a parameter but there was no
way to get the interfaces names from the container. This patch
introduces a new get_interfaces call to the API so that users
can obtain the name of the interfaces.

Support for python bindings also introduced as a part of this version.

Signed-off-by: S.Çağlar Onur 
---
 src/lxc/lxccontainer.c  | 133 ++--
 src/lxc/lxccontainer.h  |   3 +
 src/lxc/utils.c |  22 +-
 src/lxc/utils.h |   1 +
 src/python-lxc/examples/api_test.py |   5 ++
 src/python-lxc/lxc.c|  60 ++--
 src/python-lxc/lxc/__init__.py  |   8 +++
 7 files changed, 191 insertions(+), 41 deletions(-)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index d77ce37..e8dde91 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -1179,25 +1179,30 @@ static bool lxcapi_clear_config_item(struct 
lxc_container *c, const char *key)
return ret == 0;
 }
 
-char** lxcapi_get_ips(struct lxc_container *c, char* interface, char* family, 
int scope)
-{
-   int count = 0;
-   struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
-   char addressOutputBuffer[INET6_ADDRSTRLEN];
-   void *tempAddrPtr = NULL;
-   char **addresses = NULL, **temp;
-   char *address = NULL;
+static inline void exit_from_ns(struct lxc_container *c, int *old_netns, int 
*new_netns) {
+   /* Switch back to original netns */
+   if (*old_netns >= 0 && setns(*old_netns, CLONE_NEWNET))
+   SYSERROR("failed to setns");
+   process_lock();
+   if (*new_netns >= 0)
+   close(*new_netns);
+   if (*old_netns >= 0)
+   close(*old_netns);
+   process_unlock();
+}
+
+static inline bool enter_to_ns(struct lxc_container *c, int *old_netns, int 
*new_netns) {
+   int ret = 0;
char new_netns_path[MAXPATHLEN];
-   int old_netns = -1, new_netns = -1, ret = 0;
 
if (!c->is_running(c))
goto out;
 
/* Save reference to old netns */
process_lock();
-   old_netns = open("/proc/self/ns/net", O_RDONLY);
+   *old_netns = open("/proc/self/ns/net", O_RDONLY);
process_unlock();
-   if (old_netns < 0) {
+   if (*old_netns < 0) {
SYSERROR("failed to open /proc/self/ns/net");
goto out;
}
@@ -1208,17 +1213,92 @@ char** lxcapi_get_ips(struct lxc_container *c, char* 
interface, char* family, in
goto out;
 
process_lock();
-   new_netns = open(new_netns_path, O_RDONLY);
+   *new_netns = open(new_netns_path, O_RDONLY);
process_unlock();
-   if (new_netns < 0) {
+   if (*new_netns < 0) {
SYSERROR("failed to open %s", new_netns_path);
goto out;
}
 
-   if (setns(new_netns, CLONE_NEWNET)) {
+   if (setns(*new_netns, CLONE_NEWNET)) {
SYSERROR("failed to setns");
goto out;
}
+   return true;
+out:
+   exit_from_ns(c, old_netns, new_netns);
+   return false;
+}
+
+static char** lxcapi_get_interfaces(struct lxc_container *c)
+{
+   int count = 0, i;
+   bool found = false;
+   struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
+   char **interfaces = NULL, **temp;
+   int old_netns = -1, new_netns = -1;
+
+   if (!enter_to_ns(c, &old_netns, &new_netns))
+   goto out;
+
+   /* Grab the list of interfaces */
+   if (getifaddrs(&interfaceArray)) {
+   SYSERROR("failed to get interfaces list");
+   goto out;
+   }
+
+   /* Iterate through the interfaces */
+   for (tempIfAddr = interfaceArray; tempIfAddr != NULL; tempIfAddr = 
tempIfAddr->ifa_next) {
+   /*
+* WARNING: Following "for" loop does a linear search over the 
interfaces array
+* For the containers with lots of interfaces this may be 
problematic.
+* I'm not expecting this to be the common usage but if it 
turns out to be
+* than using binary search or a hash table could be more 
elegant solution.
+*/
+   for (i = 0; i < count; i++) {
+   if (strcmp(interfaces[i], tempIfAddr->ifa_name) == 0) {
+   found = true;
+   break;
+   }
+   }
+
+   if (!found) {
+   count += 1;
+   temp = realloc(interfaces, count * sizeof(*interfaces));
+   if (!temp) {
+   count -= 1;
+   goto out;
+   }
+   interfaces = temp;
+   interfaces[count - 1] = strdup(tempIfAddr->ifa_name);
+   }
+   found = false;
+}
+

Re: [lxc-devel] [PATCH trivial] lxc-create: add -P to --lxcpath option help text

2013-09-18 Thread Stéphane Graber
On Wed, Sep 18, 2013 at 02:00:42PM -0500, Serge Hallyn wrote:
> Signed-off-by: Serge Hallyn 

Acked-by: Stéphane Graber 

> ---
>  src/lxc/lxc_create.c | 32 
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/src/lxc/lxc_create.c b/src/lxc/lxc_create.c
> index ab5886b..4f205e8 100644
> --- a/src/lxc/lxc_create.c
> +++ b/src/lxc/lxc_create.c
> @@ -120,22 +120,22 @@ static struct lxc_arguments my_args = {
>  lxc-create creates a container\n\
>  \n\
>  Options :\n\
> -  -n, --name=NAME   NAME for name of the container\n\
> -  -f, --config=file initial configuration file\n\
> -  -t, --template=t  template to use to setup container\n\
> -  -B, --bdev=BDEV   backing store type to use\n\
> -  --lxcpath=PATHplace container under PATH\n\
> -  --lvname=LVNAME   Use LVM lv name LVNAME\n\
> -(Default: container name)\n\
> -  --vgname=VG   Use LVM vg called VG\n\
> -(Default: lxc))\n\
> -  --fstype=TYPE Create fstype TYPE\n\
> -(Default: ext3))\n\
> -  --fssize=SIZE Create filesystem of size SIZE\n\
> -(Default: 1G))\n\
> -  --dir=DIR Place rootfs directory under DIR\n\
> -  --zfsroot=PATHCreate zfs under given zfsroot\n\
> -(Default: tank/lxc))\n",
> +  -n, --name=NAMENAME for name of the container\n\
> +  -f, --config=file  Initial configuration file\n\
> +  -t, --template=t   Template to use to setup container\n\
> +  -B, --bdev=BDEVBacking store type to use\n\
> +  -P, --lxcpath=PATH Place container under PATH\n\
> +  --lvname=LVNAMEUse LVM lv name LVNAME\n\
> + (Default: container name)\n\
> +  --vgname=VGUse LVM vg called VG\n\
> + (Default: lxc))\n\
> +  --fstype=TYPE  Create fstype TYPE\n\
> + (Default: ext3))\n\
> +  --fssize=SIZE  Create filesystem of size SIZE\n\
> + (Default: 1G))\n\
> +  --dir=DIR  Place rootfs directory under DIR\n\
> +  --zfsroot=PATH Create zfs under given zfsroot\n\
> + (Default: tank/lxc))\n",
>   .options  = my_longopts,
>   .parser   = my_parser,
>   .checker  = NULL,
> -- 
> 1.8.1.2
> 
> 
> --
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> ___
> Lxc-devel mailing list
> Lxc-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com


signature.asc
Description: Digital signature
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


Re: [lxc-devel] [PATCH 1/1] make heavier use of process_lock (v2)

2013-09-18 Thread S . Çağlar Onur
Hi Serge,

[resending as lxc-devel rejected my first mail due to its size]

On Wed, Sep 18, 2013 at 11:20 AM, Serge Hallyn wrote:

> pthread_mutex_lock() will only return an error if it was set to
> PTHREAD_MUTEX_ERRORCHECK and we are recursively calling it (and
> would otherwise have deadlocked).  If that's the case then log a
> message for future debugging and exit.  Trying to "recover" is
> nonsense at that point.
>
> process_lock() was held over too long a time in lxcapi_start()
> in the daemonize case.  (note the non-daemonized case still needs a
> check to enforce that it must NOT be called while threaded).  Add
> process_lock() at least across all open/close/socket() calls.
>
> Anything done after a fork() doesn't need the locks as it is no
> longer threaded - so some open/close/dups()s are not locked for
> that reason.  However, some common functions are called from both
> threaded and non-threaded contexts.  So after doing a fork(), do
> a possibly-extraneous process_unlock() to make sure that, if we
> were forked while pthread mutex was held, we aren't deadlocked by
> nobody.
>
> Tested that lp:~serge-hallyn/+junk/lxc-test still works with this
> patch.
>
> lxc-test-concurrent with this patchset passes almost 100%.  I
> occasionally get failures of containers to start (but no task
> corruption) which I've yet to look into.  Certainly it seems a
> huge improvement.
>

It is a huge improvement, thanks! I'm observing very same thing that you
described with my test suite. Concurrent creates/stops/shutdowns and
destroys are now %100 passing but some start calls are failing time to time.

Tested-by: S.Çağlar Onur 


> Signed-off-by: Serge Hallyn 
> ---
>  src/lxc/af_unix.c  |  15 
>  src/lxc/apparmor.c |  11 +++
>  src/lxc/attach.c   |  35 +
>  src/lxc/bdev.c |  96 +---
>  src/lxc/caps.c |   5 ++
>  src/lxc/cgroup.c   |  35 +
>  src/lxc/commands.c |  11 +++
>  src/lxc/conf.c |  83 +++-
>  src/lxc/console.c  |  72 --
>  src/lxc/freezer.c  |   5 ++
>  src/lxc/log.c  |   7 ++
>  src/lxc/lxccontainer.c | 200
> -
>  src/lxc/lxclock.c  |   9 ++-
>  src/lxc/lxclock.h  |   2 +-
>  src/lxc/lxcutmp.c  |  11 +++
>  src/lxc/mainloop.c |  11 ++-
>  src/lxc/monitor.c  |  18 -
>  src/lxc/network.c  |   9 +++
>  src/lxc/nl.c   |   5 ++
>  src/lxc/parse.c|   5 ++
>  src/lxc/seccomp.c  |   5 ++
>  src/lxc/start.c|  31 +++-
>  src/lxc/state.c|   5 ++
>  src/lxc/sync.c |  12 ++-
>  src/lxc/utils.c|  52 +++--
>  25 files changed, 627 insertions(+), 123 deletions(-)
>

Cheers,
-- 
S.Çağlar Onur 
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] [lxc/lxc] 799f29: Add get_interfaces to the API

2013-09-18 Thread GitHub
  Branch: refs/heads/staging
  Home:   https://github.com/lxc/lxc
  Commit: 799f29ab699f08e67231b012f20a25e23a6c391d
  https://github.com/lxc/lxc/commit/799f29ab699f08e67231b012f20a25e23a6c391d
  Author: S.Çağlar Onur 
  Date:   2013-09-18 (Wed, 18 Sep 2013)

  Changed paths:
M src/lxc/lxccontainer.c
M src/lxc/lxccontainer.h
M src/lxc/utils.c
M src/lxc/utils.h
M src/python-lxc/examples/api_test.py
M src/python-lxc/lxc.c
M src/python-lxc/lxc/__init__.py

  Log Message:
  ---
  Add get_interfaces to the API

get_ips accepts an interface name as a parameter but there was no
way to get the interfaces names from the container. This patch
introduces a new get_interfaces call to the API so that users
can obtain the name of the interfaces.

Support for python bindings also introduced as a part of this version.

Signed-off-by: S.Çağlar Onur 
Acked-by: Stéphane Graber 


  Commit: 8900b9eb2514c07047541833286428572493a9fd
  https://github.com/lxc/lxc/commit/8900b9eb2514c07047541833286428572493a9fd
  Author: Stéphane Graber 
  Date:   2013-09-18 (Wed, 18 Sep 2013)

  Changed paths:
M doc/ja/common_options.sgml.in
M doc/ja/lxc-attach.sgml.in
M doc/ja/lxc-cgroup.sgml.in
M doc/ja/lxc-checkconfig.sgml.in
M doc/ja/lxc-checkpoint.sgml.in
M doc/ja/lxc-clone.sgml.in
M doc/ja/lxc-console.sgml.in
M doc/ja/lxc-create.sgml.in
M doc/ja/lxc-destroy.sgml.in
M doc/ja/lxc-device.sgml.in
M doc/ja/lxc-execute.sgml.in
M doc/ja/lxc-freeze.sgml.in
M doc/ja/lxc-info.sgml.in
M doc/ja/lxc-kill.sgml.in
M doc/ja/lxc-ls.sgml.in
M doc/ja/lxc-monitor.sgml.in
M doc/ja/lxc-netstat.sgml.in
M doc/ja/lxc-ps.sgml.in
M doc/ja/lxc-restart.sgml.in
M doc/ja/lxc-shutdown.sgml.in
M doc/ja/lxc-start-ephemeral.sgml.in
M doc/ja/lxc-start.sgml.in
M doc/ja/lxc-stop.sgml.in
M doc/ja/lxc-unfreeze.sgml.in
M doc/ja/lxc-unshare.sgml.in
M doc/ja/lxc-version.sgml.in
M doc/ja/lxc-wait.sgml.in
M doc/ja/lxc.conf.sgml.in
M doc/ja/lxc.sgml.in
M doc/ja/see_also.sgml.in
M src/lxc/cgroup.c
M src/lxc/cgroup.h
M src/lxc/commands.c

  Log Message:
  ---
  Remove trailing whitespaces

Signed-off-by: Stéphane Graber 


Compare: https://github.com/lxc/lxc/compare/025ed0f39118...8900b9eb2514
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


Re: [lxc-devel] [PATCH] Add get_interfaces to the API - v3

2013-09-18 Thread Stéphane Graber
On Wed, Sep 18, 2013 at 03:11:28PM -0400, S.Çağlar Onur wrote:
> Not at all as I already did it on my tree, sending in a minute as v4...

Thanks, and pushed!

> 
> 
> On Wed, Sep 18, 2013 at 2:58 PM, Stéphane Graber wrote:
> 
> > On Wed, Sep 18, 2013 at 02:53:33PM -0400, S.Çağlar Onur wrote:
> > > Do you want me to sync this on top of staging and re-send?I think they
> > are
> > > conflicting right now.
> >
> > Ah, if you don't mind, that'd be great (I started doing it but I'm
> > getting interrupted quite a bit since I'm attending a conference)!
> >
> > > On Wed, Sep 18, 2013 at 2:47 PM, Stéphane Graber  > >wrote:
> > >
> > > > On Mon, Sep 16, 2013 at 05:01:11PM -0400, S.Çağlar Onur wrote:
> > > > > get_ips accepts an interface name as a parameter but there was no
> > > > > way to get the interfaces names from the container. This patch
> > > > > introduces a new get_interfaces call to the API so that users
> > > > > can obtain the name of the interfaces.
> > > > >
> > > > > Support for python bindings also introduced as a part of this
> > version.
> > > > >
> > > > > Signed-off-by: S.Çağlar Onur 
> > > >
> > > > Acked-by: Stéphane Graber 
> > > >
> > > > > ---
> > > > >  src/lxc/lxccontainer.c  | 129
> > > > ++--
> > > > >  src/lxc/lxccontainer.h  |   3 +
> > > > >  src/lxc/utils.c |  22 +-
> > > > >  src/lxc/utils.h |   1 +
> > > > >  src/python-lxc/examples/api_test.py |   5 ++
> > > > >  src/python-lxc/lxc.c|  60 +++--
> > > > >  src/python-lxc/lxc/__init__.py  |   8 +++
> > > > >  7 files changed, 189 insertions(+), 39 deletions(-)
> > > > >
> > > > > diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> > > > > index 79237df..8621cd8 100644
> > > > > --- a/src/lxc/lxccontainer.c
> > > > > +++ b/src/lxc/lxccontainer.c
> > > > > @@ -1179,23 +1179,26 @@ static bool lxcapi_clear_config_item(struct
> > > > lxc_container *c, const char *key)
> > > > >   return ret == 0;
> > > > >  }
> > > > >
> > > > > -char** lxcapi_get_ips(struct lxc_container *c, char* interface,
> > char*
> > > > family, int scope)
> > > > > -{
> > > > > - int count = 0;
> > > > > - struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
> > > > > - char addressOutputBuffer[INET6_ADDRSTRLEN];
> > > > > - void *tempAddrPtr = NULL;
> > > > > - char **addresses = NULL, **temp;
> > > > > - char *address = NULL;
> > > > > +static inline void exit_from_ns(struct lxc_container *c, int
> > > > *old_netns, int *new_netns) {
> > > > > + /* Switch back to original netns */
> > > > > + if (*old_netns >= 0 && setns(*old_netns, CLONE_NEWNET))
> > > > > + SYSERROR("failed to setns");
> > > > > + if (*new_netns >= 0)
> > > > > + close(*new_netns);
> > > > > + if (*old_netns >= 0)
> > > > > + close(*old_netns);
> > > > > +}
> > > > > +
> > > > > +static inline bool enter_to_ns(struct lxc_container *c, int
> > *old_netns,
> > > > int *new_netns) {
> > > > > + int ret = 0;
> > > > >   char new_netns_path[MAXPATHLEN];
> > > > > - int old_netns = -1, new_netns = -1, ret = 0;
> > > > >
> > > > >   if (!c->is_running(c))
> > > > >   goto out;
> > > > >
> > > > >   /* Save reference to old netns */
> > > > > - old_netns = open("/proc/self/ns/net", O_RDONLY);
> > > > > - if (old_netns < 0) {
> > > > > + *old_netns = open("/proc/self/ns/net", O_RDONLY);
> > > > > + if (*old_netns < 0) {
> > > > >   SYSERROR("failed to open /proc/self/ns/net");
> > > > >   goto out;
> > > > >   }
> > > > > @@ -1205,16 +1208,91 @@ char** lxcapi_get_ips(struct lxc_container
> > *c,
> > > > char* interface, char* family, in
> > > > >   if (ret < 0 || ret >= MAXPATHLEN)
> > > > >   goto out;
> > > > >
> > > > > - new_netns = open(new_netns_path, O_RDONLY);
> > > > > - if (new_netns < 0) {
> > > > > + *new_netns = open(new_netns_path, O_RDONLY);
> > > > > + if (*new_netns < 0) {
> > > > >   SYSERROR("failed to open %s", new_netns_path);
> > > > >   goto out;
> > > > >   }
> > > > >
> > > > > - if (setns(new_netns, CLONE_NEWNET)) {
> > > > > + if (setns(*new_netns, CLONE_NEWNET)) {
> > > > >   SYSERROR("failed to setns");
> > > > >   goto out;
> > > > >   }
> > > > > + return true;
> > > > > +out:
> > > > > + exit_from_ns(c, old_netns, new_netns);
> > > > > + return false;
> > > > > +}
> > > > > +
> > > > > +static char** lxcapi_get_interfaces(struct lxc_container *c)
> > > > > +{
> > > > > + int count = 0, i;
> > > > > + bool found = false;
> > > > > + struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
> > > > > + char **interfaces = NULL, **temp;
> > > > > + int old_netns = -1, new_netns = -1;
> > > > > +
> > > > > + if (!enter_to_ns(c, &old_netns, &n

Re: [lxc-devel] [PATCH] Add get_interfaces to the API - v3

2013-09-18 Thread Stéphane Graber
On Wed, Sep 18, 2013 at 02:53:33PM -0400, S.Çağlar Onur wrote:
> Do you want me to sync this on top of staging and re-send?I think they are
> conflicting right now.

Ah, if you don't mind, that'd be great (I started doing it but I'm
getting interrupted quite a bit since I'm attending a conference)!

> On Wed, Sep 18, 2013 at 2:47 PM, Stéphane Graber wrote:
> 
> > On Mon, Sep 16, 2013 at 05:01:11PM -0400, S.Çağlar Onur wrote:
> > > get_ips accepts an interface name as a parameter but there was no
> > > way to get the interfaces names from the container. This patch
> > > introduces a new get_interfaces call to the API so that users
> > > can obtain the name of the interfaces.
> > >
> > > Support for python bindings also introduced as a part of this version.
> > >
> > > Signed-off-by: S.Çağlar Onur 
> >
> > Acked-by: Stéphane Graber 
> >
> > > ---
> > >  src/lxc/lxccontainer.c  | 129
> > ++--
> > >  src/lxc/lxccontainer.h  |   3 +
> > >  src/lxc/utils.c |  22 +-
> > >  src/lxc/utils.h |   1 +
> > >  src/python-lxc/examples/api_test.py |   5 ++
> > >  src/python-lxc/lxc.c|  60 +++--
> > >  src/python-lxc/lxc/__init__.py  |   8 +++
> > >  7 files changed, 189 insertions(+), 39 deletions(-)
> > >
> > > diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> > > index 79237df..8621cd8 100644
> > > --- a/src/lxc/lxccontainer.c
> > > +++ b/src/lxc/lxccontainer.c
> > > @@ -1179,23 +1179,26 @@ static bool lxcapi_clear_config_item(struct
> > lxc_container *c, const char *key)
> > >   return ret == 0;
> > >  }
> > >
> > > -char** lxcapi_get_ips(struct lxc_container *c, char* interface, char*
> > family, int scope)
> > > -{
> > > - int count = 0;
> > > - struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
> > > - char addressOutputBuffer[INET6_ADDRSTRLEN];
> > > - void *tempAddrPtr = NULL;
> > > - char **addresses = NULL, **temp;
> > > - char *address = NULL;
> > > +static inline void exit_from_ns(struct lxc_container *c, int
> > *old_netns, int *new_netns) {
> > > + /* Switch back to original netns */
> > > + if (*old_netns >= 0 && setns(*old_netns, CLONE_NEWNET))
> > > + SYSERROR("failed to setns");
> > > + if (*new_netns >= 0)
> > > + close(*new_netns);
> > > + if (*old_netns >= 0)
> > > + close(*old_netns);
> > > +}
> > > +
> > > +static inline bool enter_to_ns(struct lxc_container *c, int *old_netns,
> > int *new_netns) {
> > > + int ret = 0;
> > >   char new_netns_path[MAXPATHLEN];
> > > - int old_netns = -1, new_netns = -1, ret = 0;
> > >
> > >   if (!c->is_running(c))
> > >   goto out;
> > >
> > >   /* Save reference to old netns */
> > > - old_netns = open("/proc/self/ns/net", O_RDONLY);
> > > - if (old_netns < 0) {
> > > + *old_netns = open("/proc/self/ns/net", O_RDONLY);
> > > + if (*old_netns < 0) {
> > >   SYSERROR("failed to open /proc/self/ns/net");
> > >   goto out;
> > >   }
> > > @@ -1205,16 +1208,91 @@ char** lxcapi_get_ips(struct lxc_container *c,
> > char* interface, char* family, in
> > >   if (ret < 0 || ret >= MAXPATHLEN)
> > >   goto out;
> > >
> > > - new_netns = open(new_netns_path, O_RDONLY);
> > > - if (new_netns < 0) {
> > > + *new_netns = open(new_netns_path, O_RDONLY);
> > > + if (*new_netns < 0) {
> > >   SYSERROR("failed to open %s", new_netns_path);
> > >   goto out;
> > >   }
> > >
> > > - if (setns(new_netns, CLONE_NEWNET)) {
> > > + if (setns(*new_netns, CLONE_NEWNET)) {
> > >   SYSERROR("failed to setns");
> > >   goto out;
> > >   }
> > > + return true;
> > > +out:
> > > + exit_from_ns(c, old_netns, new_netns);
> > > + return false;
> > > +}
> > > +
> > > +static char** lxcapi_get_interfaces(struct lxc_container *c)
> > > +{
> > > + int count = 0, i;
> > > + bool found = false;
> > > + struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
> > > + char **interfaces = NULL, **temp;
> > > + int old_netns = -1, new_netns = -1;
> > > +
> > > + if (!enter_to_ns(c, &old_netns, &new_netns))
> > > + goto out;
> > > +
> > > + /* Grab the list of interfaces */
> > > + if (getifaddrs(&interfaceArray)) {
> > > + SYSERROR("failed to get interfaces list");
> > > + goto out;
> > > + }
> > > +
> > > + /* Iterate through the interfaces */
> > > + for (tempIfAddr = interfaceArray; tempIfAddr != NULL; tempIfAddr =
> > tempIfAddr->ifa_next) {
> > > + /*
> > > +  * WARNING: Following "for" loop does a linear search over
> > the interfaces array
> > > +  * For the containers with lots of interfaces this may be
> > problematic.
> > > + * I'm not expecting this to be the commo

Re: [lxc-devel] [PATCH] Add get_interfaces to the API - v3

2013-09-18 Thread S . Çağlar Onur
Not at all as I already did it on my tree, sending in a minute as v4...


On Wed, Sep 18, 2013 at 2:58 PM, Stéphane Graber wrote:

> On Wed, Sep 18, 2013 at 02:53:33PM -0400, S.Çağlar Onur wrote:
> > Do you want me to sync this on top of staging and re-send?I think they
> are
> > conflicting right now.
>
> Ah, if you don't mind, that'd be great (I started doing it but I'm
> getting interrupted quite a bit since I'm attending a conference)!
>
> > On Wed, Sep 18, 2013 at 2:47 PM, Stéphane Graber  >wrote:
> >
> > > On Mon, Sep 16, 2013 at 05:01:11PM -0400, S.Çağlar Onur wrote:
> > > > get_ips accepts an interface name as a parameter but there was no
> > > > way to get the interfaces names from the container. This patch
> > > > introduces a new get_interfaces call to the API so that users
> > > > can obtain the name of the interfaces.
> > > >
> > > > Support for python bindings also introduced as a part of this
> version.
> > > >
> > > > Signed-off-by: S.Çağlar Onur 
> > >
> > > Acked-by: Stéphane Graber 
> > >
> > > > ---
> > > >  src/lxc/lxccontainer.c  | 129
> > > ++--
> > > >  src/lxc/lxccontainer.h  |   3 +
> > > >  src/lxc/utils.c |  22 +-
> > > >  src/lxc/utils.h |   1 +
> > > >  src/python-lxc/examples/api_test.py |   5 ++
> > > >  src/python-lxc/lxc.c|  60 +++--
> > > >  src/python-lxc/lxc/__init__.py  |   8 +++
> > > >  7 files changed, 189 insertions(+), 39 deletions(-)
> > > >
> > > > diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> > > > index 79237df..8621cd8 100644
> > > > --- a/src/lxc/lxccontainer.c
> > > > +++ b/src/lxc/lxccontainer.c
> > > > @@ -1179,23 +1179,26 @@ static bool lxcapi_clear_config_item(struct
> > > lxc_container *c, const char *key)
> > > >   return ret == 0;
> > > >  }
> > > >
> > > > -char** lxcapi_get_ips(struct lxc_container *c, char* interface,
> char*
> > > family, int scope)
> > > > -{
> > > > - int count = 0;
> > > > - struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
> > > > - char addressOutputBuffer[INET6_ADDRSTRLEN];
> > > > - void *tempAddrPtr = NULL;
> > > > - char **addresses = NULL, **temp;
> > > > - char *address = NULL;
> > > > +static inline void exit_from_ns(struct lxc_container *c, int
> > > *old_netns, int *new_netns) {
> > > > + /* Switch back to original netns */
> > > > + if (*old_netns >= 0 && setns(*old_netns, CLONE_NEWNET))
> > > > + SYSERROR("failed to setns");
> > > > + if (*new_netns >= 0)
> > > > + close(*new_netns);
> > > > + if (*old_netns >= 0)
> > > > + close(*old_netns);
> > > > +}
> > > > +
> > > > +static inline bool enter_to_ns(struct lxc_container *c, int
> *old_netns,
> > > int *new_netns) {
> > > > + int ret = 0;
> > > >   char new_netns_path[MAXPATHLEN];
> > > > - int old_netns = -1, new_netns = -1, ret = 0;
> > > >
> > > >   if (!c->is_running(c))
> > > >   goto out;
> > > >
> > > >   /* Save reference to old netns */
> > > > - old_netns = open("/proc/self/ns/net", O_RDONLY);
> > > > - if (old_netns < 0) {
> > > > + *old_netns = open("/proc/self/ns/net", O_RDONLY);
> > > > + if (*old_netns < 0) {
> > > >   SYSERROR("failed to open /proc/self/ns/net");
> > > >   goto out;
> > > >   }
> > > > @@ -1205,16 +1208,91 @@ char** lxcapi_get_ips(struct lxc_container
> *c,
> > > char* interface, char* family, in
> > > >   if (ret < 0 || ret >= MAXPATHLEN)
> > > >   goto out;
> > > >
> > > > - new_netns = open(new_netns_path, O_RDONLY);
> > > > - if (new_netns < 0) {
> > > > + *new_netns = open(new_netns_path, O_RDONLY);
> > > > + if (*new_netns < 0) {
> > > >   SYSERROR("failed to open %s", new_netns_path);
> > > >   goto out;
> > > >   }
> > > >
> > > > - if (setns(new_netns, CLONE_NEWNET)) {
> > > > + if (setns(*new_netns, CLONE_NEWNET)) {
> > > >   SYSERROR("failed to setns");
> > > >   goto out;
> > > >   }
> > > > + return true;
> > > > +out:
> > > > + exit_from_ns(c, old_netns, new_netns);
> > > > + return false;
> > > > +}
> > > > +
> > > > +static char** lxcapi_get_interfaces(struct lxc_container *c)
> > > > +{
> > > > + int count = 0, i;
> > > > + bool found = false;
> > > > + struct ifaddrs *interfaceArray = NULL, *tempIfAddr = NULL;
> > > > + char **interfaces = NULL, **temp;
> > > > + int old_netns = -1, new_netns = -1;
> > > > +
> > > > + if (!enter_to_ns(c, &old_netns, &new_netns))
> > > > + goto out;
> > > > +
> > > > + /* Grab the list of interfaces */
> > > > + if (getifaddrs(&interfaceArray)) {
> > > > + SYSERROR("failed to get interfaces list");
> > > > + goto out;
> > > > + }
> > > > +
> > > > + /* Iterate through the interfaces */
> > >

[lxc-devel] [lxc/lxc] e3f46b: lxc-create: add -P to --lxcpath option help text

2013-09-18 Thread GitHub
  Branch: refs/heads/staging
  Home:   https://github.com/lxc/lxc
  Commit: e3f46bfbcffb48b65d71058ca4437f50e72e9de8
  https://github.com/lxc/lxc/commit/e3f46bfbcffb48b65d71058ca4437f50e72e9de8
  Author: Serge Hallyn 
  Date:   2013-09-18 (Wed, 18 Sep 2013)

  Changed paths:
M src/lxc/lxc_create.c

  Log Message:
  ---
  lxc-create: add -P to --lxcpath option help text

Signed-off-by: Serge Hallyn 
Acked-by: Stéphane Graber 



--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] Cells open source release

2013-09-18 Thread Jeremy C. Andrus
Hello everyone,

On behalf of myself and the rest of the Cells team here at Columbia
University, I would like to announce the release of the Cells open
source project:
  info: http://cells.cs.columbia.edu/
  code: https://cells-source.cs.columbia.edu/

Cells provides multiple, isolated, virtual Android instances runnning
on a single device with support for smartphone and tablet hardware
including 3D graphics, WiFi, touchscreen input, and more. This release
targets the ASUS Nexus 7 (grouper) tablet, and supports essential
Android drivers and subsystems such as Android alarms, frame buffer
earlysuspend, wakelocks (suspend blockers), binder, and logger.

Users can create, modify, delete, start, and stop instances of Android
(Cells) using a command-line tool called "cell" through the standard
Android adb shell. Users can switch between instances of Android using
a key combo on their device (volume up + volume down on the Nexus 7),
or through the cell command.

We achieve all this by leveraging containers and namespaces in the
kernel, and by building on recently released kernel patches to support
device namespaces: https://github.com/Cellrox/devns-patches

Cells is minimally intrusive to the Android open-source project (AOSP)
code base with our Nexus 7 prototype requiring only a few small patches
to the Jelly Bean 4.3 repositories. A list of patches applied on top of both
AOSP, and the Nexus 7 Tegra kernel can be seen using a search on the
Cells Gerrit Review site:
https://cells-source.cs.columbia.edu/#/q/status:merged+topic:cells-nexus7,n,z

We invite anyone interested to download, build, and play with Cells.
We provide a guide on how to download, build, and contribute to the
sources here:
  http://cells.cs.columbia.edu/build/

We invite you to join the project mailing list and encourage you to ask
questions and discuss the sources on the list:
  ce...@lists.cs.columbia.edu
  https://lists.cs.columbia.edu/cucslists/listinfo/cells

Best Regards,

   -Jeremy

-- 
Cells: A Virtual Mobile Smartphone Architecture
Proceedings of the 23rd ACM Symposium on Operating Systems Principles (SOSP 
2011)
[pdf]: http://systems.cs.columbia.edu/files/wpid-cells-sosp2011.pdf
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] Cells open source release

2013-09-18 Thread Jeremy C. Andrus
Hello everyone,

On behalf of myself and the rest of the Cells team here at Columbia
University, I would like to announce the release of the Cells open
source project:
   info: http://cells.cs.columbia.edu/
   code: https://cells-source.cs.columbia.edu/

Cells provides multiple, isolated, virtual Android instances runnning
on a single device with support for smartphone and tablet hardware
including 3D graphics, WiFi, touchscreen input, and more. This release
targets the ASUS Nexus 7 (grouper) tablet, and supports essential
Android drivers and subsystems such as Android alarms, frame buffer
earlysuspend, wakelocks (suspend blockers), binder, and logger.

Users can create, modify, delete, start, and stop instances of Android
(Cells) using a command-line tool called "cell" through the standard
Android adb shell. Users can switch between instances of Android using
a key combo on their device (volume up + volume down on the Nexus 7),
or through the cell command.

We achieve all this by leveraging containers and namespaces in the
kernel, and by building on recently released kernel patches to support
device namespaces: https://github.com/Cellrox/devns-patches

Cells is minimally intrusive to the Android open-source project (AOSP)
code base with our Nexus 7 prototype requiring only a few small patches
to the Jelly Bean 4.3 repositories. A list of patches applied on top of both
AOSP, and the Nexus 7 Tegra kernel can be seen using a search on the
Cells Gerrit Review site:
https://cells-source.cs.columbia.edu/#/q/status:merged+topic:cells-nexus7,n,z

We invite anyone interested to download, build, and play with Cells.
We provide a guide on how to download, build, and contribute to the
sources here:
   http://cells.cs.columbia.edu/build/

We invite you to join the project mailing list and encourage you to ask
questions and discuss the sources on the list:
   ce...@lists.cs.columbia.edu
   https://lists.cs.columbia.edu/cucslists/listinfo/cells

Best Regards,

-Jeremy

-- 
Cells: A Virtual Mobile Smartphone Architecture
Proceedings of the 23rd ACM Symposium on Operating Systems Principles (SOSP 
2011)
[pdf]: http://systems.cs.columbia.edu/files/wpid-cells-sosp2011.pdf
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel