Imported Upstream version 1.1.1 upstream/1.1.1
authorDariusz Michaluk <d.michaluk@samsung.com>
Mon, 30 Mar 2015 14:49:04 +0000 (16:49 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Mon, 30 Mar 2015 14:49:04 +0000 (16:49 +0200)
33 files changed:
CONTRIBUTING
config/init/common/lxc-net.in
config/init/sysvinit/Makefile.in
config/templates/common.conf.in
config/templates/debian.common.conf.in
config/templates/gentoo.common.conf.in
config/templates/openwrt.common.conf.in
config/templates/plamo.common.conf.in
config/templates/ubuntu.common.conf.in
configure
configure.ac
doc/ja/lxc-clone.sgml.in
doc/ja/lxc-create.sgml.in
doc/ja/lxc-snapshot.sgml.in
doc/lxc-clone.sgml.in
doc/lxc-create.sgml.in
doc/lxc-snapshot.sgml.in
lxc.spec
src/lxc/attach.c
src/lxc/bdev.c
src/lxc/conf.c
src/lxc/confile.c
src/lxc/lxc-restore-net
src/lxc/lxc_top.c
src/lxc/lxccontainer.c
src/lxc/seccomp.c
src/lxc/utils.c
src/lxc/utils.h
src/lxc/version.h
templates/lxc-centos.in
templates/lxc-download.in
templates/lxc-gentoo.in
templates/lxc-plamo.in

index 6b62c48..afdffa1 100644 (file)
@@ -1,7 +1,5 @@
-
-        Contributing to this project
-        ----------------------------
-
+Contributing to this project
+----------------------------
 
 This project accepts contributions. In order to contribute, you should
 pay attention to a few things:
index dcbe155..988d2f9 100644 (file)
@@ -35,29 +35,31 @@ _netmask2cidr ()
 }
 
 ifdown() {
-    which ifconfig >/dev/null 2>&1
-    if [ $? = 0 ]; then
-        ifconfig $1 down
-        return
-    fi
     which ip >/dev/null 2>&1
     if [ $? = 0 ]; then
         ip link set dev $1 down
+        return
     fi
-}
-
-ifup() {
     which ifconfig >/dev/null 2>&1
     if [ $? = 0 ]; then
-        ifconfig $1 $2 netmask $3 up
+        ifconfig $1 down
         return
     fi
+}
+
+ifup() {
     which ip >/dev/null 2>&1
     if [ $? = 0 ]; then
         MASK=`_netmask2cidr ${LXC_NETMASK}`
         CIDR_ADDR="${LXC_ADDR}/${MASK}"
         ip addr add ${CIDR_ADDR} dev $1
         ip link set dev $1 up
+        return
+    fi
+    which ifconfig >/dev/null 2>&1
+    if [ $? = 0 ]; then
+        ifconfig $1 $2 netmask $3 up
+        return
     fi
 }
 
index 7a140d7..e01d557 100644 (file)
@@ -387,8 +387,8 @@ distclean-generic:
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
-@INIT_SCRIPT_SYSV_FALSE@uninstall-local:
 @INIT_SCRIPT_SYSV_FALSE@install-data-local:
+@INIT_SCRIPT_SYSV_FALSE@uninstall-local:
 clean: clean-am
 
 clean-am: clean-generic mostlyclean-am
index 26b3229..80f31ce 100644 (file)
@@ -42,9 +42,12 @@ lxc.cgroup.devices.allow = c 1:8 rwm
 lxc.cgroup.devices.allow = c 1:9 rwm
 ### /dev/pts/*
 lxc.cgroup.devices.allow = c 136:* rwm
+### fuse
+lxc.cgroup.devices.allow = c 10:229 rwm
 
 # Setup the default mounts
 lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
+lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections none bind,optional 0 0
 
 # Blacklist some syscalls which are not safe in privileged
 # containers
index 493feee..e034b95 100644 (file)
@@ -4,9 +4,6 @@ lxc.include = @LXCTEMPLATECONFIG@/common.conf
 # Doesn't support consoles in /dev/lxc/
 lxc.devttydir =
 
-# Default mount entries
-lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections none bind,optional 0 0
-
 # When using LXC with apparmor, the container will be confined by default.
 # If you wish for it to instead run unconfined, copy the following line
 # (uncommented) to the container's configuration file.
@@ -24,8 +21,6 @@ lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections none bind,opt
 # Extra cgroup device access
 ## rtc
 lxc.cgroup.devices.allow = c 254:0 rm
-## fuse
-lxc.cgroup.devices.allow = c 10:229 rwm
 ## tun
 lxc.cgroup.devices.allow = c 10:200 rwm
 ## hpet
index 01c8f48..ca3ffc1 100644 (file)
@@ -12,8 +12,6 @@ lxc.devttydir =
 # Extra cgroup device access
 ## rtc
 lxc.cgroup.devices.allow = c 254:0 rm
-## fuse
-lxc.cgroup.devices.allow = c 10:229 rwm
 ## tun
 lxc.cgroup.devices.allow = c 10:200 rwm
 ## hpet
index 6609333..878e839 100644 (file)
@@ -34,8 +34,6 @@ lxc.cgroup.devices.allow = c 5:2 rwm
 lxc.cgroup.devices.allow = c 136:* rwm
 ## rtc
 lxc.cgroup.devices.allow = c 254:0 rm
-## fuse
-lxc.cgroup.devices.allow = c 10:229 rwm
 ## tun
 lxc.cgroup.devices.allow = c 10:200 rwm
 ## dev/tty0
index e7809e1..718fc53 100644 (file)
@@ -1,17 +1,9 @@
 # This derives from the global common config
 lxc.include = @LXCTEMPLATECONFIG@/common.conf
 
-# Default mount
-lxc.mount.entry = none dev/shm tmpfs nosuid,nodev,noexec,mode=1777 0 0
-
 # Doesn't support consoles in /dev/lxc/
 lxc.devttydir =
 
-# /dev/* is created manually by template
-lxc.autodev = 0
-
 # Extra cgroup device access
 ## rtc
 lxc.cgroup.devices.allow = c 254:0 rm
-## fuse
-lxc.cgroup.devices.allow = c 10:229 rwm
index d1ce8e9..857c255 100644 (file)
@@ -2,7 +2,6 @@
 lxc.include = @LXCTEMPLATECONFIG@/common.conf
 
 # Default mount entries
-lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections none bind,optional 0 0
 lxc.mount.entry = /sys/kernel/debug sys/kernel/debug none bind,optional 0 0
 lxc.mount.entry = /sys/kernel/security sys/kernel/security none bind,optional 0 0
 lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none bind,optional 0 0
@@ -28,8 +27,6 @@ lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none bind,optional 0 0
 # Extra cgroup device access
 ## rtc
 lxc.cgroup.devices.allow = c 254:0 rm
-## fuse
-lxc.cgroup.devices.allow = c 10:229 rwm
 ## tun
 lxc.cgroup.devices.allow = c 10:200 rwm
 ## hpet
index dff7f5b..cacbc98 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for lxc 1.1.0.
+# Generated by GNU Autoconf 2.69 for lxc 1.1.1.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='lxc'
 PACKAGE_TARNAME='lxc'
-PACKAGE_VERSION='1.1.0'
-PACKAGE_STRING='lxc 1.1.0'
+PACKAGE_VERSION='1.1.1'
+PACKAGE_STRING='lxc 1.1.1'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1435,7 +1435,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures lxc 1.1.0 to adapt to many kinds of systems.
+\`configure' configures lxc 1.1.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1505,7 +1505,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of lxc 1.1.0:";;
+     short | recursive ) echo "Configuration of lxc 1.1.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1665,7 +1665,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-lxc configure 1.1.0
+lxc configure 1.1.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2130,7 +2130,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by lxc $as_me 1.1.0, which was
+It was created by lxc $as_me 1.1.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2601,7 +2601,7 @@ $as_echo "no" >&6; }
        fi
 fi
 
-LXC_VERSION_BASE=1.1.0
+LXC_VERSION_BASE=1.1.1
 
 
 
@@ -2609,9 +2609,9 @@ LXC_VERSION_MAJOR=1
 
 LXC_VERSION_MINOR=1
 
-LXC_VERSION_MICRO=0
+LXC_VERSION_MICRO=1
 
-LXC_VERSION=1.1.0
+LXC_VERSION=1.1.1
 
 
 
@@ -3132,7 +3132,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='lxc'
- VERSION='1.1.0'
+ VERSION='1.1.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -9874,7 +9874,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by lxc $as_me 1.1.0, which was
+This file was extended by lxc $as_me 1.1.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -9944,7 +9944,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-lxc config.status 1.1.0
+lxc config.status 1.1.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index f5d6438..0190d8c 100644 (file)
@@ -3,7 +3,7 @@
 
 m4_define([lxc_version_major], 1)
 m4_define([lxc_version_minor], 1)
-m4_define([lxc_version_micro], 0)
+m4_define([lxc_version_micro], 1)
 m4_define([lxc_version_beta], [])
 
 m4_define([lxc_version_base], [lxc_version_major.lxc_version_minor.lxc_version_micro])
index 0a7448b..963b3a1 100644 (file)
@@ -145,9 +145,11 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
        <listitem>
          <para>
             <!--
-            The new container's rootfs should be a LVM or btrfs snapshot of the original.
-            -->
-            新しいコンテナの rootfs は、オリジナルの LVM か btrfs のスナップショットになります。
+           The new container's rootfs will be a snapshot of the original. This option can be specified when the backing store is LVM, btrfs or zfs, and must be specified when you want to snapshot using aufs or overlayfs.
+              -->
+           新しいコンテナの rootfs はオリジナルのスナップショットとなります。
+           このオプションはバッキングストアが LVM か btrfs か zfs の時に使用できます。
+           また、スナップショットを aufs か overlayfs で取得したい場合は指定する必要があります。
          </para>
        </listitem>
       </varlistentry>
index 4525817..f8b6064 100644 (file)
@@ -200,6 +200,12 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
             <replaceable>--fssize SIZE</replaceable> はデフォルト値である 1G の代わりに SIZE で指定したサイズで LV を作成します。
          </para>
          <para>
+           <!--
+           If backingstore is 'loop', you can use <replaceable>&#045;&#045;fstype FSTYPE</replaceable> and <replaceable>&#045;&#045;fssize SIZE</replaceable> as 'lvm'. The default values for these options are the same as 'lvm'.
+           -->
+           backingstore が 'loop' の場合、'lvm' と同様に <replaceable>--fstype FSTYPE</replaceable> と <replaceable>--fssize SIZE</replaceable> が使えます。これらの値のデフォルト値は 'lvm' の場合と同じです。
+         </para>
+         <para>
             <!--
            If backingstore is 'best', then lxc will try, in order, btrfs,
            zfs, lvm, and finally a directory backing store.
index f0f6289..16e483f 100644 (file)
@@ -88,10 +88,12 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
     </para>
     <para>
       <!--
-    Snapshots are stored as snapshotted containers under a private configuration path.  For instance, if the container's configuration path is <filename>/var/lib/lxc</filename> and the container is <filename>c1</filename>, then the first snapshot will be stored as container <filename>snap0</filename> under configuration path <filename>/var/lib/lxcsnaps/c1</filename>.
-    -->
-      スナップショットは、専用の設定されたパス以下にスナップショット化されたコンテナとして保存されます。
-      例えば、もしコンテナパスが <filename>/var/lib/lxc</filename> で、コンテナが <filename>c1</filename> である場合、最初に取得するスナップショットは、パス <filename>/var/lib/lxcsnaps/c1</filename> の下の <filename>snap0</filename> として保存されます。
+      Snapshots are stored as snapshotted containers under the container's configuration path. For instance, if the container's configuration path is <filename>/var/lib/lxc</filename> and the container is <filename>c1</filename>, then the first snapshot will be stored as container <filename>snap0</filename> under the path <filename>/var/lib/lxc/c1/snaps</filename>.
+      If <filename>/var/lib/lxcsnaps</filename>, as used by LXC 1.0, already exists, then it will continue to be used.
+        -->
+      スナップショットはコンテナパス以下にスナップショット化されたコンテナとして保存されます。
+      例えば、もしコンテナパスが <filename>/var/lib/lxc</filename> で、コンテナが <filename>c1</filename> である場合、最初に取得するスナップショットは、パス <filename>/var/lib/lxc/c1/snaps</filename> の下の <filename>snap0</filename> として保存されます。
+      LXC 1.0 で使われていた <filename>/var/lib/lxcsnaps</filename> が存在する場合には、このディレクトリが引き続き使われます。
     </para>
   </refsect1>
 
index edd6032..11b26b8 100644 (file)
@@ -121,7 +121,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
        </term>
        <listitem>
          <para>
-           The new container's rootfs should be a LVM or btrfs snapshot of the original.
+           The new container's rootfs will be a snapshot of the original. This option can be specified when the backing store is LVM, btrfs or zfs, and must be specified when you want to snapshot using aufs or overlayfs.
          </para>
        </listitem>
       </varlistentry>
index 683067b..3339bf3 100644 (file)
@@ -155,6 +155,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
            filesystem) of size SIZE rather than the default, which is 1G.
          </para>
          <para>
+           If backingstore is 'loop', you can use <replaceable>--fstype FSTYPE</replaceable> and <replaceable>--fssize SIZE</replaceable> as 'lvm'. The default values for these options are the same as 'lvm'.
+         </para>
+         <para>
            If backingstore is 'best', then lxc will try, in order, btrfs,
            zfs, lvm, and finally a directory backing store.
          </para>
index 029534e..5c7ea53 100644 (file)
@@ -79,7 +79,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
       container snapshots.
     </para>
     <para>
-    Snapshots are stored as snapshotted containers under a private configuration path.  For instance, if the container's configuration path is <filename>/var/lib/lxc</filename> and the container is <filename>c1</filename>, then the first snapshot will be stored as container <filename>snap0</filename> under configuration path <filename>/var/lib/lxcsnaps/c1</filename>.
+      Snapshots are stored as snapshotted containers under the container's configuration path. For instance, if the container's configuration path is <filename>/var/lib/lxc</filename> and the container is <filename>c1</filename>, then the first snapshot will be stored as container <filename>snap0</filename> under the path <filename>/var/lib/lxc/c1/snaps</filename>.
+      If <filename>/var/lib/lxcsnaps</filename>, as used by LXC 1.0, already exists, then it will continue to be used.
     </para>
   </refsect1>
 
index 34112e8..15c7f32 100644 (file)
--- a/lxc.spec
+++ b/lxc.spec
@@ -60,7 +60,7 @@ BuildRequires: systemd
 %endif
 
 Name: lxc
-Version: 1.1.0
+Version: 1.1.1
 Release: %{?beta_rel:0.1.%{beta_rel}}%{?!beta_rel:%{norm_rel}}%{?dist}
 URL: http://linuxcontainers.org
 Source: http://linuxcontainers.org/downloads/%{name}-%{version}%{?beta_dot}.tar.gz
index 497e0d2..faa90fc 100644 (file)
@@ -575,7 +575,7 @@ struct attach_clone_payload {
 static int attach_child_main(void* data);
 
 /* help the optimizer along if it doesn't know that exit always exits */
-#define rexit(c)  do { int __c = (c); exit(__c); return __c; } while(0)
+#define rexit(c)  do { int __c = (c); _exit(__c); return __c; } while(0)
 
 /* define default options if no options are supplied by the user */
 static lxc_attach_options_t attach_static_default_options = LXC_ATTACH_OPTIONS_DEFAULT;
@@ -984,6 +984,21 @@ static int attach_child_main(void* data)
        if (options->gid != (gid_t)-1)
                new_gid = options->gid;
 
+       /* setup the control tty */
+       if (options->stdin_fd) {
+               if (setsid() < 0) {
+                       SYSERROR("unable to setsid");
+                       shutdown(ipc_socket, SHUT_RDWR);
+                       rexit(-1);
+               }
+
+               if (ioctl(options->stdin_fd, TIOCSCTTY, (char *)NULL) < 0) {
+                       SYSERROR("unable to TIOCSTTY");
+                       shutdown(ipc_socket, SHUT_RDWR);
+                       rexit(-1);
+               }
+       }
+
        /* try to set the uid/gid combination */
        if ((new_gid != 0 || options->namespaces & CLONE_NEWUSER)) {
                if (setgid(new_gid) || setgroups(0, NULL)) {
index 197ab55..cf7c043 100644 (file)
@@ -3403,8 +3403,12 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
        *needs_rdep = 0;
        if (bdevtype && strcmp(orig->type, "dir") == 0 &&
                        (strcmp(bdevtype, "aufs") == 0 ||
-                        strcmp(bdevtype, "overlayfs") == 0))
+                        strcmp(bdevtype, "overlayfs") == 0)) {
                *needs_rdep = 1;
+       } else if (snap && strcmp(orig->type, "lvm") == 0 &&
+                       !lvm_is_thin_volume(orig->src)) {
+               *needs_rdep = 1;
+       }
 
        new = bdev_get(bdevtype ? bdevtype : orig->type);
        if (!new) {
index fbe82b5..2868708 100644 (file)
@@ -752,8 +752,10 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha
                 * 2.6.32...
                 */
                { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc",                                              "%r/proc",                      "proc",     MS_NODEV|MS_NOEXEC|MS_NOSUID,   NULL },
+               { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "%r/proc/sys/net",                                   "%r/proc/net",                  NULL,       MS_BIND,                        NULL },
                { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "%r/proc/sys",                                       "%r/proc/sys",                  NULL,       MS_BIND,                        NULL },
                { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, NULL,                                                "%r/proc/sys",                  NULL,       MS_REMOUNT|MS_BIND|MS_RDONLY,   NULL },
+               { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "%r/proc/net",                                       "%r/proc/sys/net",              NULL,       MS_MOVE,                        NULL },
                { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "%r/proc/sysrq-trigger",                             "%r/proc/sysrq-trigger",        NULL,       MS_BIND,                        NULL },
                { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, NULL,                                                "%r/proc/sysrq-trigger",        NULL,       MS_REMOUNT|MS_BIND|MS_RDONLY,   NULL },
                { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_RW,    "proc",                                              "%r/proc",                      "proc",     MS_NODEV|MS_NOEXEC|MS_NOSUID,   NULL },
@@ -798,7 +800,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha
                                        default_mounts[i].flags);
                        r = mount(source, destination, default_mounts[i].fstype, mflags, default_mounts[i].options);
                        saved_errno = errno;
-                       if (r < 0)
+                       if (r < 0 && errno == ENOENT) {
+                               INFO("Mount source or target for %s on %s doesn't exist. Skipping.", source, destination);
+                               r = 0;
+                       }
+                       else if (r < 0)
                                SYSERROR("error mounting %s on %s flags %lu", source, destination, mflags);
 
                        free(source);
index 8544ac9..740487b 100644 (file)
@@ -2197,6 +2197,7 @@ static int lxc_get_auto_mounts(struct lxc_conf *c, char *retv, int inlen)
        switch (c->auto_mounts & LXC_AUTO_SYS_MASK) {
                case LXC_AUTO_SYS_RO:             strprint(retv, inlen, "%ssys:ro", sep);            sep = " "; break;
                case LXC_AUTO_SYS_RW:             strprint(retv, inlen, "%ssys:rw", sep);            sep = " "; break;
+               case LXC_AUTO_SYS_MIXED:          strprint(retv, inlen, "%ssys:mixed", sep);         sep = " "; break;
                default: break;
        }
        switch (c->auto_mounts & LXC_AUTO_CGROUP_MASK) {
index 1725dc3..6ae3c19 100755 (executable)
@@ -17,7 +17,7 @@ while true; do
 
        if [ "$CRTOOLS_SCRIPT_ACTION" = "network-unlock" ]; then
                brctl addif $bridge $veth
-               ifconfig $veth 0.0.0.0 up
+               ip link set dev $veth up
        fi
 
        i=$((i+1))
index 8840405..8501461 100644 (file)
@@ -303,7 +303,7 @@ static void stats_print(const char *name, const struct stats *stats,
        size_humanize(stats->blkio, blkio_str, sizeof(blkio_str));
        size_humanize(stats->mem_used, mem_used_str, sizeof(mem_used_str));
 
-       printf("%-18s %8.2f %8.2f %8.2f %10s %10s",
+       printf("%-18.18s %8.2f %8.2f %8.2f %10s %10s",
               name,
               (float)stats->cpu_use_nanos / 1000000000,
               (float)stats->cpu_use_sys  / USER_HZ,
index 4da1627..e02ee93 100644 (file)
@@ -598,6 +598,7 @@ static bool lxcapi_start(struct lxc_container *c, int useinit, char * const argv
        * while container is running...
        */
        if (daemonize) {
+               char title[2048];
                lxc_monitord_spawn(c->config_path);
 
                pid_t pid = fork();
@@ -612,6 +613,14 @@ static bool lxcapi_start(struct lxc_container *c, int useinit, char * const argv
                        return wait_on_daemonized_start(c, pid);
                }
 
+               /* We don't really care if this doesn't print all the
+                * characters; all that it means is that the proctitle will be
+                * ugly. Similarly, we also don't care if setproctitle()
+                * fails. */
+               snprintf(title, sizeof(title), "[lxc monitor] %s %s", c->config_path, c->name);
+               INFO("Attempting to set proc title to %s", title);
+               setproctitle(title);
+
                /* second fork to be reparented by init */
                pid = fork();
                if (pid < 0) {
index 3ba6c9a..108faa0 100644 (file)
@@ -121,6 +121,9 @@ enum lxc_hostarch_t {
        lxc_seccomp_arch_i386,
        lxc_seccomp_arch_amd64,
        lxc_seccomp_arch_arm,
+       lxc_seccomp_arch_ppc64,
+       lxc_seccomp_arch_ppc64le,
+       lxc_seccomp_arch_ppc,
        lxc_seccomp_arch_unknown = 999,
 };
 
@@ -137,6 +140,12 @@ int get_hostarch(void)
                return lxc_seccomp_arch_amd64;
        else if (strncmp(uts.machine, "armv7", 5) == 0)
                return lxc_seccomp_arch_arm;
+       else if (strncmp(uts.machine, "ppc64le", 7) == 0)
+               return lxc_seccomp_arch_ppc64le;
+       else if (strncmp(uts.machine, "ppc64", 5) == 0)
+               return lxc_seccomp_arch_ppc64;
+       else if (strncmp(uts.machine, "ppc", 3) == 0)
+               return lxc_seccomp_arch_ppc;
        return lxc_seccomp_arch_unknown;
 }
 
@@ -150,6 +159,15 @@ scmp_filter_ctx get_new_ctx(enum lxc_hostarch_t n_arch, uint32_t default_policy_
        case lxc_seccomp_arch_i386: arch = SCMP_ARCH_X86; break;
        case lxc_seccomp_arch_amd64: arch = SCMP_ARCH_X86_64; break;
        case lxc_seccomp_arch_arm: arch = SCMP_ARCH_ARM; break;
+#ifdef SCMP_ARCH_PPC64LE
+       case lxc_seccomp_arch_ppc64le: arch = SCMP_ARCH_PPC64LE; break;
+#endif
+#ifdef SCMP_ARCH_PPC64
+       case lxc_seccomp_arch_ppc64: arch = SCMP_ARCH_PPC64; break;
+#endif
+#ifdef SCMP_ARCH_PPC
+       case lxc_seccomp_arch_ppc: arch = SCMP_ARCH_PPC; break;
+#endif
        default: return NULL;
        }
 
@@ -343,6 +361,36 @@ static int parse_config_v2(FILE *f, char *line, struct lxc_conf *conf)
                                cur_rule_arch = lxc_seccomp_arch_arm;
                        }
 #endif
+#ifdef SCMP_ARCH_PPC64LE
+                       else if (strcmp(line, "[ppc64le]") == 0 ||
+                                       strcmp(line, "[PPC64LE]") == 0) {
+                               if (native_arch != lxc_seccomp_arch_ppc64le) {
+                                       cur_rule_arch = lxc_seccomp_arch_unknown;
+                                       continue;
+                               }
+                               cur_rule_arch = lxc_seccomp_arch_ppc64le;
+                       }
+#endif
+#ifdef SCMP_ARCH_PPC64
+                       else if (strcmp(line, "[ppc64]") == 0 ||
+                                       strcmp(line, "[PPC64]") == 0) {
+                               if (native_arch != lxc_seccomp_arch_ppc64) {
+                                       cur_rule_arch = lxc_seccomp_arch_unknown;
+                                       continue;
+                               }
+                               cur_rule_arch = lxc_seccomp_arch_ppc64;
+                       }
+#endif
+#ifdef SCMP_ARCH_PPC
+                       else if (strcmp(line, "[ppc]") == 0 ||
+                                       strcmp(line, "[PPC]") == 0) {
+                               if (native_arch != lxc_seccomp_arch_ppc) {
+                                       cur_rule_arch = lxc_seccomp_arch_unknown;
+                                       continue;
+                               }
+                               cur_rule_arch = lxc_seccomp_arch_ppc;
+                       }
+#endif
                        else
                                goto bad_arch;
 
index 93de1c3..e66a01f 100644 (file)
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <assert.h>
+#include <sys/prctl.h>
 
 #include "utils.h"
 #include "log.h"
 #include "lxclock.h"
 #include "namespace.h"
 
+#ifndef PR_SET_MM
+#define PR_SET_MM 35
+#endif
+
+#ifndef PR_SET_MM_ARG_START
+#define PR_SET_MM_ARG_START 8
+#endif
+
+#ifndef PR_SET_MM_ARG_END
+#define PR_SET_MM_ARG_END 9
+#endif
+
+#ifndef PR_SET_MM_ENV_START
+#define PR_SET_MM_ENV_START 10
+#endif
+
+#ifndef PR_SET_MM_ENV_END
+#define PR_SET_MM_ENV_END 11
+#endif
+
 lxc_log_define(lxc_utils, lxc);
 
 static int _recursive_rmdir_onedev(char *dirname, dev_t pdev,
@@ -1540,3 +1561,73 @@ char *get_template_path(const char *t)
 
        return tpath;
 }
+
+/*
+ * Sets the process title to the specified title. Note:
+ *   1. this function requires root to succeed
+ *   2. it clears /proc/self/environ
+ *   3. it may not succed (e.g. if title is longer than /proc/self/environ +
+ *      the original title)
+ */
+int setproctitle(char *title)
+{
+       char buf[2048], *tmp;
+       FILE *f;
+       int i, len, ret = 0;
+       unsigned long arg_start, arg_end, env_start, env_end;
+
+       f = fopen_cloexec("/proc/self/stat", "r");
+       if (!f) {
+               return -1;
+       }
+
+       tmp = fgets(buf, sizeof(buf), f);
+       fclose(f);
+       if (!tmp) {
+               return -1;
+       }
+
+       /* Skip the first 47 fields, column 48-51 are ARG_START and
+        * ARG_END. */
+       tmp = strchr(buf, ' ');
+       for (i = 0; i < 46; i++) {
+               if (!tmp)
+                       return -1;
+               tmp = strchr(tmp+1, ' ');
+       }
+
+       if (!tmp)
+               return -1;
+
+       i = sscanf(tmp, "%lu %lu %lu %lu", &arg_start, &arg_end, &env_start, &env_end);
+       if (i != 4) {
+               return -1;
+       }
+
+       /* Include the null byte here, because in the calculations below we
+        * want to have room for it. */
+       len = strlen(title) + 1;
+
+       /* We're truncating the environment, so we should use at most the
+        * length of the argument + environment for the title. */
+       if (len > env_end - arg_start) {
+               arg_end = env_end;
+               len = env_end - arg_start;
+       } else {
+               /* Only truncate the environment if we're actually going to
+                * overwrite part of it. */
+               if (len >= arg_end - arg_start) {
+                       env_start = env_end;
+               }
+               arg_end = arg_start + len;
+       }
+
+       strcpy((char*)arg_start, title);
+
+       ret |= prctl(PR_SET_MM, PR_SET_MM_ARG_START,   (long)arg_start, 0, 0);
+       ret |= prctl(PR_SET_MM, PR_SET_MM_ARG_END,     (long)arg_end, 0, 0);
+       ret |= prctl(PR_SET_MM, PR_SET_MM_ENV_START,   (long)env_start, 0, 0);
+       ret |= prctl(PR_SET_MM, PR_SET_MM_ENV_END,     (long)env_end, 0, 0);
+
+       return ret;
+}
index b23cd8e..cc18906 100644 (file)
@@ -286,3 +286,4 @@ int print_to_file(const char *file, const char *content);
 bool switch_to_ns(pid_t pid, const char *ns);
 int is_dir(const char *path);
 char *get_template_path(const char *t);
+int setproctitle(char *title);
index c086f8c..ff6b926 100644 (file)
@@ -25,7 +25,7 @@
 
 #define LXC_VERSION_MAJOR 1
 #define LXC_VERSION_MINOR 1
-#define LXC_VERSION_MICRO 0
-#define LXC_VERSION "1.1.0"
+#define LXC_VERSION_MICRO 1
+#define LXC_VERSION "1.1.1"
 
 #endif
index dd9b254..1588042 100644 (file)
@@ -413,7 +413,11 @@ download_centos()
 
     # download a mini centos into a cache
     echo "Downloading centos minimal ..."
-    YUM="yum --installroot $INSTALL_ROOT -y --nogpgcheck --releasever=$release"
+    if [ $release -le 5 ];then
+        YUM="yum --installroot $INSTALL_ROOT -y --nogpgcheck"
+    else
+        YUM="yum --installroot $INSTALL_ROOT -y --nogpgcheck --releasever=$release"
+    fi
     PKG_LIST="yum initscripts passwd rsyslog vim-minimal openssh-server openssh-clients dhclient chkconfig rootfiles policycoreutils"
 
     # use temporary repository definition
index 722f95f..e0a812f 100644 (file)
@@ -575,6 +575,11 @@ for file in $TEMPLATE_FILES; do
     sed -i "s#LXC_HOOK_DIR#$LXC_HOOK_DIR#g" $file
 done
 
+# prevent mingetty from calling vhangup(2) since it fails with userns on Centos / Oracle
+if [ -f ${LXC_ROOTFS}/etc/init/tty.conf ]; then
+    sed -i 's|mingetty|mingetty --nohangup|' ${LXC_ROOTFS}/etc/init/tty.conf
+fi
+
 if [ -n "$LXC_MAPPED_UID" ] && [ "$LXC_MAPPED_UID" != "-1" ]; then
     chown $LXC_MAPPED_UID $LXC_PATH/config $LXC_PATH/fstab >/dev/null 2>&1 || true
 fi
index 92edcd4..0a76766 100644 (file)
@@ -160,7 +160,7 @@ cache_stage3()
         printf "Determining path to latest Gentoo %s (%s) stage3 archive...\n" "${arch}" "${variant}"
         printf " => downloading and processing %s\n" "${stage3_pointer}"
 
-        local stage3_latest_tarball=$(wget -q -O - "${stage3_pointer}" | tail -n1 ) \
+        local stage3_latest_tarball=$(wget -q -O - "${stage3_pointer}" | tail -n1 | cut -d' ' -f1) \
             || die 6 "Error: unable to fetch\n"
 
         printf " => Got: %s\n" "${stage3_latest_tarball}"
@@ -641,11 +641,11 @@ container_auth()
     if [[ -r "${auth_key}" ]]; then
         printf " deploying auth_key %s for user %s ...\n" "${auth_key}" "${user}"
         mkdir -p "${rootfs}/${auth_home}/.ssh"
-        cat >> "${rootfs}/${auth_home}/.ssh/authorized_keys"
+        cat "${auth_key}" >> "${rootfs}/${auth_home}/.ssh/authorized_keys"
         chroot "${rootfs}" chown "${user}:" "${auth_home}/.ssh/authorized_keys"
         printf "  => inserted public key in %s/.ssh/authorized_keys\n" "${auth_home}"
         [[ -z "${forced_password}" ]] && unset password
-        store_user_message "${user} has the ssh key you gived us"
+        store_user_message "${user} has the ssh key you gave us"
     fi
 
     if [[ -n "${password}" ]]; then
@@ -782,7 +782,7 @@ user="root"
 password="toor"
 tty=1
 settings="common"
-options=$(getopt -o hp:n:a:FcPv:t:S:u:w:s:m: -l help,rootfs:,path:,name:,arch:,flush-cache,cache-only,private-portage,variant:,portage-dir:,tarball:,auth_key:,user:,autologin,password:,settings:,mirror:,tty: -- "$@")
+options=$(getopt -o hp:n:a:FcPv:t:S:u:w:s:m: -l help,rootfs:,path:,name:,arch:,flush-cache,cache-only,private-portage,variant:,portage-dir:,tarball:,auth-key:,user:,autologin,password:,settings:,mirror:,tty: -- "$@")
 
 eval set -- "$options"
 
index c588ddb..3e2a8f2 100644 (file)
@@ -147,23 +147,6 @@ install_plamo() {
 }
 
 configure_plamo() {
-  # create /dev
-  chmod    666 $rootfs/dev/null
-  mknod -m 666 $rootfs/dev/zero c 1 5
-  chmod    666 $rootfs/dev/random
-  mknod -m 666 $rootfs/dev/urandom c 1 9
-  mkdir -m 755 $rootfs/dev/pts
-  mkdir -m 755 $rootfs/dev/shm
-  chmod    666 $rootfs/dev/tty
-  chmod    600 $rootfs/dev/console
-  mknod -m 666 $rootfs/dev/tty0 c 4 0
-  mknod -m 666 $rootfs/dev/tty1 c 4 1
-  mknod -m 666 $rootfs/dev/tty2 c 4 2
-  mknod -m 666 $rootfs/dev/tty3 c 4 3
-  mknod -m 666 $rootfs/dev/tty4 c 4 4
-  mknod -m 666 $rootfs/dev/full c 1 7
-  mknod -m 600 $rootfs/dev/initctl p
-  mknod -m 666 $rootfs/dev/ptmx c 5 2
   # suppress log level output for udev
   sed -i 's/="err"/=0/' $rootfs/etc/udev/udev.conf
   # /etc/fstab
@@ -207,10 +190,9 @@ configure_plamo() {
   echo "Setting root password to 'root'..."
   echo "root:root" | chroot $rootfs chpasswd
   echo "Please change root password!"
-  # /etc/rc.d/rc.S
   ed - $rootfs/etc/rc.d/rc.S <<- "EOF"
-       /^mount -w -n -t proc/;/^# ln -s \/bin\/true/-1d
-       /^mknod \/dev\/unikey/;/^# Clean \/etc\/mtab/-2d
+       /^mount -w -n -t proc/;/^mkdir \/dev\/shm/-1d
+       /^mknod \/dev\/null/;/^# Clean \/etc\/mtab/-2d
        /^# copy the rules/;/^# Set the hostname/-1d
        /^# Check the integrity/;/^# Clean up temporary/-1d
        w