Re: [lxc-devel] Mailing-list move on Sunday 8th of December

2013-12-05 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com):
 Hello,
 
 You are receiving this e-mail because you are currently subscribed to:
  lxc-devel@lists.sourceforge.net
 
 On this coming Sunday (8th of December), all LXC mailing-lists will be
 moved to a new home at:
  http://lists.linuxcontainers.org
 
 This is the last step of our migration out of sourceforge. The new
 mailman server is hosted by myself and shared with a few other projects

\o/ - thanks, Stéphane.  Huge improvement.

-serge

--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk
___
lxc-devel mailing list
lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] [lxc/lxc] a02656: Make lxc-user-nic use mkifname

2013-12-05 Thread GitHub
  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: a0265685269fa24387a8871151db84199028c715
  https://github.com/lxc/lxc/commit/a0265685269fa24387a8871151db84199028c715
  Author: Stéphane Graber stgra...@ubuntu.com
  Date:   2013-12-05 (Thu, 05 Dec 2013)

  Changed paths:
M src/lxc/conf.c
M src/lxc/lxc_user_nic.c
M src/lxc/network.c
M src/lxc/network.h

  Log Message:
  ---
  Make lxc-user-nic use mkifname

NetworkManager at least expects all veth devices to be called veth*
otherwise it'll consider them as physical interface and try to do DHCP
on them.

This change makes lxc-user-nic use the same function that we use for LXC
itself which will give us standard vethX kind of interfaces.

Signed-off-by: Stéphane Graber stgra...@ubuntu.com
Acked-by: Serge E. Hallyn serge.hal...@ubuntu.com


--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk___
lxc-devel mailing list
lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] [PATCH] Add support for new create=(dir, file) mount option

2013-12-05 Thread Stéphane Graber
Just like we already had optional, this adds two new LXC-specific
mount flags:
 - create=dir (will do a mkdir_p on the path)
 - create=file (will do a mkdir_p on the dirname + a fopen on the path)

This was motivated by some of the needed bind-mounts for the
unprivileged containers.

Signed-off-by: Stéphane Graber stgra...@ubuntu.com
---
 src/lxc/conf.c | 70 +-
 1 file changed, 69 insertions(+), 1 deletion(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 6542ce1..0beb12b 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -1906,18 +1906,41 @@ static inline int mount_entry_on_systemfs(struct mntent 
*mntent)
unsigned long mntflags;
char *mntdata;
int ret;
+   FILE *pathfile = NULL;
+   char* pathdirname = NULL;
 
if (parse_mntopts(mntent-mnt_opts, mntflags, mntdata)  0) {
ERROR(failed to parse mount option '%s', mntent-mnt_opts);
return -1;
}
 
+   if (hasmntopt(mntent, create=dir)) {
+   if (!mkdir_p(mntent-mnt_dir, 0755)) {
+   WARN(Failed to create mount target '%s', 
mntent-mnt_dir);
+   ret = -1;
+   }
+   }
+
+   if (hasmntopt(mntent, create=file)  access(mntent-mnt_dir, F_OK)) {
+   pathdirname = strdup(mntent-mnt_dir);
+   pathdirname = dirname(pathdirname);
+   mkdir_p(pathdirname, 0755);
+   pathfile = fopen(mntent-mnt_dir, wb);
+   if (!pathfile) {
+   WARN(Failed to create mount target '%s', 
mntent-mnt_dir);
+   ret = -1;
+   }
+   else
+   fclose(pathfile);
+   }
+
ret = mount_entry(mntent-mnt_fsname, mntent-mnt_dir,
  mntent-mnt_type, mntflags, mntdata);
 
if (hasmntopt(mntent, optional) != NULL)
ret = 0;
 
+   free(pathdirname);
free(mntdata);
 
return ret;
@@ -1933,6 +1956,8 @@ static int mount_entry_on_absolute_rootfs(struct mntent 
*mntent,
char *mntdata;
int r, ret = 0, offset;
const char *lxcpath;
+   FILE *pathfile = NULL;
+   char *pathdirname = NULL;
 
if (parse_mntopts(mntent-mnt_opts, mntflags, mntdata)  0) {
ERROR(failed to parse mount option '%s', mntent-mnt_opts);
@@ -1975,6 +2000,25 @@ skipabs:
goto out;
}
 
+   if (hasmntopt(mntent, create=dir)) {
+   if (!mkdir_p(path, 0755)) {
+   WARN(Failed to create mount target '%s', path);
+   ret = -1;
+   }
+   }
+
+   if (hasmntopt(mntent, create=file)  access(path, F_OK)) {
+   pathdirname = strdup(path);
+   pathdirname = dirname(pathdirname);
+   mkdir_p(pathdirname, 0755);
+   pathfile = fopen(path, wb);
+   if (!pathfile) {
+   WARN(Failed to create mount target '%s', path);
+   ret = -1;
+   }
+   else
+   fclose(pathfile);
+   }
 
ret = mount_entry(mntent-mnt_fsname, path, mntent-mnt_type,
  mntflags, mntdata);
@@ -1983,6 +2027,7 @@ skipabs:
ret = 0;
 
 out:
+   free(pathdirname);
free(mntdata);
return ret;
 }
@@ -1994,25 +2039,48 @@ static int mount_entry_on_relative_rootfs(struct mntent 
*mntent,
unsigned long mntflags;
char *mntdata;
int ret;
+   FILE *pathfile = NULL;
+   char *pathdirname = NULL;
 
if (parse_mntopts(mntent-mnt_opts, mntflags, mntdata)  0) {
ERROR(failed to parse mount option '%s', mntent-mnt_opts);
return -1;
}
 
-/* relative to root mount point */
+   /* relative to root mount point */
ret = snprintf(path, sizeof(path), %s/%s, rootfs, mntent-mnt_dir);
if (ret = sizeof(path)) {
ERROR(path name too long);
return -1;
}
 
+   if (hasmntopt(mntent, create=dir)) {
+   if (!mkdir_p(path, 0755)) {
+   WARN(Failed to create mount target '%s', path);
+   ret = -1;
+   }
+   }
+
+   if (hasmntopt(mntent, create=file)  access(path, F_OK)) {
+   pathdirname = strdup(path);
+   pathdirname = dirname(pathdirname);
+   mkdir_p(pathdirname, 0755);
+   pathfile = fopen(path, wb);
+   if (!pathfile) {
+   WARN(Failed to create mount target '%s', path);
+   ret = -1;
+   }
+   else
+   fclose(pathfile);
+   }
+
ret = mount_entry(mntent-mnt_fsname, path, mntent-mnt_type,
  mntflags, mntdata);
 
if (hasmntopt(mntent, 

[lxc-devel] [PATCH] conffile.c: Also clear text entries with no value

2013-12-05 Thread Stéphane Graber
Signed-off-by: Stéphane Graber stgra...@ubuntu.com
---
 src/lxc/confile.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 835153b..5f25e08 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -216,8 +216,12 @@ static int config_string_item(char **conf_item, const char 
*value)
 {
char *new_value;
 
-   if (!value || strlen(value) == 0)
+   if (!value || strlen(value) == 0) {
+   if (*conf_item)
+   free(*conf_item);
+   *conf_item = NULL;
return 0;
+   }
 
new_value = strdup(value);
if (!new_value) {
-- 
1.8.5.1


--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk
___
lxc-devel mailing list
lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] [PATCH] Move some common Ubuntu config

2013-12-05 Thread Stéphane Graber
This introduces a new /usr/share/lxc/config directory containing common
configuration snippets.

The two Ubuntu templates are then simplified to just include the
relevant entries avoiding a whole lot of hardcoded cgroup, capabilities
and mount points configuration.

An extra comment is also added at the top of all generated configuration
files telling the user to look at lxc.conf(5) for more information.

Signed-off-by: Stéphane Graber stgra...@ubuntu.com
---
 config/Makefile.am   |  16 +
 config/default.conf.libvirt  |   3 -
 config/default.conf.ubuntu   |   3 -
 config/default.conf.unknown  |   1 -
 config/etc/Makefile.am   |  15 
 config/etc/default.conf.libvirt  |   3 +
 config/etc/default.conf.ubuntu   |   3 +
 config/etc/default.conf.unknown  |   1 +
 config/templates/Makefile.am |   8 +++
 config/templates/ubuntu-cloud.common.conf.in |   4 ++
 config/templates/ubuntu-cloud.lucid.conf.in  |   2 +
 config/templates/ubuntu-cloud.userns.conf.in |  16 +
 config/templates/ubuntu.common.conf.in   |  48 +
 config/templates/ubuntu.lucid.conf.in|   2 +
 configure.ac |   9 +++
 src/lxc/lxccontainer.c   |   1 +
 templates/lxc-ubuntu-cloud.in| 102 +--
 templates/lxc-ubuntu.in  |  87 ---
 18 files changed, 178 insertions(+), 146 deletions(-)
 delete mode 100644 config/default.conf.libvirt
 delete mode 100644 config/default.conf.ubuntu
 delete mode 100644 config/default.conf.unknown
 create mode 100644 config/etc/Makefile.am
 create mode 100644 config/etc/default.conf.libvirt
 create mode 100644 config/etc/default.conf.ubuntu
 create mode 100644 config/etc/default.conf.unknown
 create mode 100644 config/templates/Makefile.am
 create mode 100644 config/templates/ubuntu-cloud.common.conf.in
 create mode 100644 config/templates/ubuntu-cloud.lucid.conf.in
 create mode 100644 config/templates/ubuntu-cloud.userns.conf.in
 create mode 100644 config/templates/ubuntu.common.conf.in
 create mode 100644 config/templates/ubuntu.lucid.conf.in

diff --git a/config/Makefile.am b/config/Makefile.am
index 81d7709..7ca23eb 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -1,15 +1 @@
-configdir = $(sysconfdir)/lxc
-config_DATA = default.conf
-distroconf = @LXC_DISTRO_CONF@
-
-EXTRA_DIST = default.conf.ubuntu default.conf.libvirt default.conf.unknown
-
-default.conf:
-   cp $(distroconf) $@
-
-clean-local:
-   @$(RM) -f default.conf
-
-distclean-local:
-   @$(RM) -f default.conf
-   @$(RM) -f compile config.guess config.sub depcomp install-sh ltmain.sh 
missing Makefile.in Makefile
+SUBDIRS = etc templates
diff --git a/config/default.conf.libvirt b/config/default.conf.libvirt
deleted file mode 100644
index 6950dca..000
--- a/config/default.conf.libvirt
+++ /dev/null
@@ -1,3 +0,0 @@
-lxc.network.type = veth
-lxc.network.link = virbr0
-lxc.network.flags = up
diff --git a/config/default.conf.ubuntu b/config/default.conf.ubuntu
deleted file mode 100644
index 0a5ac71..000
--- a/config/default.conf.ubuntu
+++ /dev/null
@@ -1,3 +0,0 @@
-lxc.network.type = veth
-lxc.network.link = lxcbr0
-lxc.network.flags = up
diff --git a/config/default.conf.unknown b/config/default.conf.unknown
deleted file mode 100644
index 6c88010..000
--- a/config/default.conf.unknown
+++ /dev/null
@@ -1 +0,0 @@
-lxc.network.type = empty
diff --git a/config/etc/Makefile.am b/config/etc/Makefile.am
new file mode 100644
index 000..81d7709
--- /dev/null
+++ b/config/etc/Makefile.am
@@ -0,0 +1,15 @@
+configdir = $(sysconfdir)/lxc
+config_DATA = default.conf
+distroconf = @LXC_DISTRO_CONF@
+
+EXTRA_DIST = default.conf.ubuntu default.conf.libvirt default.conf.unknown
+
+default.conf:
+   cp $(distroconf) $@
+
+clean-local:
+   @$(RM) -f default.conf
+
+distclean-local:
+   @$(RM) -f default.conf
+   @$(RM) -f compile config.guess config.sub depcomp install-sh ltmain.sh 
missing Makefile.in Makefile
diff --git a/config/etc/default.conf.libvirt b/config/etc/default.conf.libvirt
new file mode 100644
index 000..6950dca
--- /dev/null
+++ b/config/etc/default.conf.libvirt
@@ -0,0 +1,3 @@
+lxc.network.type = veth
+lxc.network.link = virbr0
+lxc.network.flags = up
diff --git a/config/etc/default.conf.ubuntu b/config/etc/default.conf.ubuntu
new file mode 100644
index 000..0a5ac71
--- /dev/null
+++ b/config/etc/default.conf.ubuntu
@@ -0,0 +1,3 @@
+lxc.network.type = veth
+lxc.network.link = lxcbr0
+lxc.network.flags = up
diff --git a/config/etc/default.conf.unknown b/config/etc/default.conf.unknown
new file mode 100644
index 000..6c88010
--- /dev/null
+++ b/config/etc/default.conf.unknown
@@ -0,0 +1 @@
+lxc.network.type = empty
diff --git a/config/templates/Makefile.am b/config/templates/Makefile.am
new file 

[lxc-devel] [PATCH] doc: Update Japanese lxc.conf(5)

2013-12-05 Thread KATOH Yasufumi
translate the untranslated paragraph

Signed-off-by: KATOH Yasufumi ka...@jazz.email.ne.jp
---
 doc/ja/lxc.conf.sgml.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/ja/lxc.conf.sgml.in b/doc/ja/lxc.conf.sgml.in
index ec24e2a..52b4fc8 100644
--- a/doc/ja/lxc.conf.sgml.in
+++ b/doc/ja/lxc.conf.sgml.in
@@ -1220,8 +1220,11 @@ by KATOH Yasufumi karma at jazz.email.ne.jp
  /term
  listitem
para
+  !--
  Specify the SELinux context under which the container should
  be run or commandunconfined_t/command. For example
+  --
+  コンテナが従うべき SELinux コンテキストを指定するか,commandunconfined_t/command 
を指定します.例えば以下のように設定します.
/para
programlistinglxc.se_context = 
unconfined_u:unconfined_r:lxc_t:s0-s0:c0.c1023/programlisting
  /listitem
-- 
1.8.4.4


--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk
___
lxc-devel mailing list
lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel