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

2012-11-27 Thread Stéphane Graber
On 11/27/2012 02:13 AM, Natanael Copa wrote:
> There is no reason to depend on bash for a single echo.
> 
> Signed-off-by: Natanael Copa 

Applied to staging. Thanks.

As for whether to move that code to lxc-info, I don't think that'd be
the right thing to do as lxc-info is meant to retrieve information from
a container, not from the host.

However, I think it'd make sense to have the version exposed by the C
API so that we may be able to implement a consistent "--version" to all
LXC commands that'd return the lxc version number.
If we do that, then there won't be any need for lxc-version anymore.

> ---
> Changes v1 -> v2:
>  - add signed-off-by
> 
>  src/lxc/lxc-version.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lxc/lxc-version.in b/src/lxc/lxc-version.in
> index 1bd055a..b6875da 100644
> --- a/src/lxc/lxc-version.in
> +++ b/src/lxc/lxc-version.in
> @@ -1,3 +1,3 @@
> -#!/bin/bash
> +#!/bin/sh
>  
>  echo "lxc version: @PACKAGE_VERSION@"
> 


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



signature.asc
Description: OpenPGP digital signature
--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


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

2012-11-27 Thread Stéphane Graber
On 11/27/2012 02:27 AM, Natanael Copa wrote:
> - replace 'echo -e' with printf
> - replace 'if [[ ... ]]' with 'if [ ... ]'
> - add \ at after && and || when those are at end of line
> 
> Signed-off-by: Natanael Copa 

Looks good, acked and added to the staging branch. Thanks

> ---
> Changes v1 -> v2:
>  - rebase against current staging
> 
>  src/lxc/lxc-checkconfig.in | 32 
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/src/lxc/lxc-checkconfig.in b/src/lxc/lxc-checkconfig.in
> index 7dd6476..d17bb95 100644
> --- a/src/lxc/lxc-checkconfig.in
> +++ b/src/lxc/lxc-checkconfig.in
> @@ -1,13 +1,13 @@
> -#!/bin/bash
> +#!/bin/sh
>  
>  # Allow environment variables to override grep and config
>  : ${CONFIG:=/proc/config.gz}
>  : ${GREP:=zgrep}
>  
> -SETCOLOR_SUCCESS="echo -en \\033[1;32m"
> -SETCOLOR_FAILURE="echo -en \\033[1;31m"
> -SETCOLOR_WARNING="echo -en \\033[1;33m"
> -SETCOLOR_NORMAL="echo -en \\033[0;39m"
> +SETCOLOR_SUCCESS="printf \\e[1;32m"
> +SETCOLOR_FAILURE="printf \\e[1;31m"
> +SETCOLOR_WARNING="printf \\e[1;33m"
> +SETCOLOR_NORMAL="printf \\e[0;39m"
>  
>  is_set() {
>  $GREP -q "$1=[y|m]" $CONFIG
> @@ -21,12 +21,12 @@ is_enabled() {
>  RES=$?
>  
>  if [ $RES -eq 0 ]; then
> - $SETCOLOR_SUCCESS && echo -e "enabled" && $SETCOLOR_NORMAL
> + $SETCOLOR_SUCCESS && echo "enabled" && $SETCOLOR_NORMAL
>  else
>   if [ ! -z "$mandatory" -a "$mandatory" = yes ]; then
> - $SETCOLOR_FAILURE && echo -e "required" && $SETCOLOR_NORMAL
> + $SETCOLOR_FAILURE && echo "required" && $SETCOLOR_NORMAL
>   else
> - $SETCOLOR_WARNING && echo -e "missing" && $SETCOLOR_NORMAL
> + $SETCOLOR_WARNING && echo "missing" && $SETCOLOR_NORMAL
>   fi
>  fi
>  }
> @@ -70,7 +70,7 @@ print_cgroups() {
>  CGROUP_MNT_PATH=`print_cgroups cgroup /proc/self/mounts | head -1`
>  KVER_MAJOR=$($GREP '^# Linux' $CONFIG | \
>  sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/')
> -if [[ $KVER_MAJOR == 2 ]]; then
> +if [ "$KVER_MAJOR" = "2" ]; then
>  KVER_MINOR=$($GREP '^# Linux' $CONFIG | \
>  sed -r 's/.* 2.6.([0-9]{2}).*/\1/')
>  else
> @@ -82,7 +82,7 @@ echo -n "Cgroup: " && is_enabled CONFIG_CGROUPS yes
>  
>  if [ -f $CGROUP_MNT_PATH/cgroup.clone_children ]; then
>  echo -n "Cgroup clone_children flag: " &&
> -$SETCOLOR_SUCCESS && echo -e "enabled" && $SETCOLOR_NORMAL
> +$SETCOLOR_SUCCESS && echo "enabled" && $SETCOLOR_NORMAL
>  else
>  echo -n "Cgroup namespace: " && is_enabled CONFIG_CGROUP_NS yes
>  fi
> @@ -101,12 +101,12 @@ echo "--- Misc ---"
>  echo -n "Veth pair device: " && is_enabled CONFIG_VETH
>  echo -n "Macvlan: " && is_enabled CONFIG_MACVLAN
>  echo -n "Vlan: " && is_enabled CONFIG_VLAN_8021Q
> -echo -n "File capabilities: " &&
> -( [[ ${KVER_MAJOR} == 2 && ${KVER_MINOR} < 33 ]] &&
> -   is_enabled CONFIG_SECURITY_FILE_CAPABILITIES ) ||
> -( [[ ( ${KVER_MAJOR} == 2 && ${KVER_MINOR} > 32 ) ||
> - ${KVER_MAJOR} > 2 ]] && $SETCOLOR_SUCCESS &&
> - echo -e "enabled" && $SETCOLOR_NORMAL )
> +echo -n "File capabilities: " && \
> +( [ "${KVER_MAJOR}" = 2 ] && [ ${KVER_MINOR} -lt 33 ] && \
> +   is_enabled CONFIG_SECURITY_FILE_CAPABILITIES ) || \
> +( ( [ "${KVER_MAJOR}" = "2" ] && [ ${KVER_MINOR} -gt 32 ] ) || \
> + [ ${KVER_MAJOR} -gt 2 ] && $SETCOLOR_SUCCESS && \
> + echo "enabled" && $SETCOLOR_NORMAL )
>  
>  echo
>  echo "Note : Before booting a new kernel, you can check its configuration"
> 


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



signature.asc
Description: OpenPGP digital signature
--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


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

2012-11-27 Thread Stéphane Graber
On 11/26/2012 03:57 PM, Dwight Engen wrote:
> LXCDIR is only used in lxc_container_new, whereas LXCPATH is used throughout
> the rest of lxc, and even in the same file as lxc_container_new (for example
> create_container_dir()).
> 
> Signed-off-by: Dwight Engen 

Good catch.

Acked-by: Stéphane Graber 

And pushed to staging.

> ---
>  src/lxc/lxccontainer.c |6 +++---
>  src/lxc/lxccontainer.h |1 -
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index ed2c483..cc91e05 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -882,13 +882,13 @@ struct lxc_container *lxc_container_new(char *name)
>   goto err;
>   }
>  
> - len = strlen(LXCDIR)+strlen(c->name)+strlen("/config")+2;
> + len = strlen(LXCPATH)+strlen(c->name)+strlen("/config")+2;
>   c->configfile = malloc(len);
>   if (!c->configfile) {
>   fprintf(stderr, "Error allocating config file pathname\n");
>   goto err;
>   }
> - ret = snprintf(c->configfile, len, "%s/%s/config", LXCDIR, c->name);
> + ret = snprintf(c->configfile, len, "%s/%s/config", LXCPATH, c->name);
>   if (ret < 0 || ret >= len) {
>   fprintf(stderr, "Error printing out config file name\n");
>   goto err;
> @@ -928,7 +928,7 @@ struct lxc_container *lxc_container_new(char *name)
>   }
>  
>   /*
> -  * default configuration file is $LXCDIR/$NAME/config
> +  * default configuration file is $LXCPATH/$NAME/config
>*/
>  
>   return c;
> diff --git a/src/lxc/lxccontainer.h b/src/lxc/lxccontainer.h
> index cad31ee..9e4267a 100644
> --- a/src/lxc/lxccontainer.h
> +++ b/src/lxc/lxccontainer.h
> @@ -18,7 +18,6 @@ struct lxc_container {
>   int error_num;
>   int daemonize;
>  
> -#define LXCDIR "/var/lib/lxc"
>   bool (*is_defined)(struct lxc_container *c);  // did 
> /var/lib/lxc/$name/config exist
>   const char *(*state)(struct lxc_container *c);
>   bool (*is_running)(struct lxc_container *c);  // true so long as 
> defined and not stopped
> 


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



signature.asc
Description: OpenPGP digital signature
--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


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

2012-11-27 Thread Stéphane Graber
On 11/26/2012 04:37 PM, Natanael Copa wrote:
> Avoid getopt --longoptions
> 
> Signed-off-by: Natanael Copa 

Looks reasonable, though I'm not usually using that script so didn't
actually test the change.

Acked-by: Stéphane Graber 

And pushed to staging. Thanks.

> ---
>  src/lxc/lxc-setcap.in | 34 +-
>  1 file changed, 21 insertions(+), 13 deletions(-)
> 
> diff --git a/src/lxc/lxc-setcap.in b/src/lxc/lxc-setcap.in
> index 7fd390c..02c1e09 100644
> --- a/src/lxc/lxc-setcap.in
> +++ b/src/lxc/lxc-setcap.in
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>  
>  #
>  # lxc: linux Container library
> @@ -81,32 +81,40 @@ lxc_dropcaps()
>  chmod 0755 @LXCPATH@
>  }
>  
> -shortoptions='hd'
> -longoptions='help'
> -
> -getopt=$(getopt -o $shortoptions --longoptions  $longoptions -- "$@")
> -if [ $? != 0 ]; then
> +usage_err() {
> +[ -n "$1" ] && echo "$1" >&2
>  usage
>  exit 1
> -fi
> +}
>  
> -eval set -- "$getopt"
> +optarg_check() {
> +if [ -z "$2" ]; then
> +usage_err "option '$1' requires an argument"
> +fi
> +}
>  
> -while true; do
> -case "$1" in
> +while [ $# -gt 0 ]; do
> +opt="$1"
> +shift
> +case "$opt" in
>   -d)
>   LXC_DROP_CAPS="yes"
> - shift
>   ;;
>   -h|--help)
>   help
>   exit 0
>   ;;
>   --)
> - shift
>   break
>   ;;
> - *)
> +-?)
> +usage_err "unknown option '$opt'"
> +;;
> +-*)
> +# split opts -abc into -a -b -c
> +set -- $(echo "${opt#-}" | sed 's/\(.\)/ -\1/g') "$@"
> +;;
> + *)
>   usage
>   exit 1
>   ;;
> 


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



signature.asc
Description: OpenPGP digital signature
--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


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

2012-11-27 Thread Stéphane Graber
On 11/26/2012 04:39 PM, Natanael Copa wrote:
> Avoid getop --longoptions.
> 
> Signed-off-by: Natanael Copa 

Looks reasonable, though I'm not usually using that script so didn't
actually test the change.

Acked-by: Stéphane Graber 

And pushed to staging. Thanks.

> ---
>  src/lxc/lxc-setuid.in | 34 +-
>  1 file changed, 21 insertions(+), 13 deletions(-)
> 
> diff --git a/src/lxc/lxc-setuid.in b/src/lxc/lxc-setuid.in
> index 84f18af..e6a7b96 100644
> --- a/src/lxc/lxc-setuid.in
> +++ b/src/lxc/lxc-setuid.in
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>  
>  #
>  # lxc: linux Container library
> @@ -78,32 +78,40 @@ lxc_dropuid()
>  chmod 0755 @LXCPATH@
>  }
>  
> -shortoptions='hd'
> -longoptions='help'
> -
> -getopt=$(getopt -o $shortoptions --longoptions  $longoptions -- "$@")
> -if [ $? != 0 ]; then
> +usage_err() {
> +[ -n "$1" ] && echo "$1" >&2
>  usage
>  exit 1
> -fi
> +}
>  
> -eval set -- "$getopt"
> +optarg_check() {
> +if [ -z "$2" ]; then
> +usage_err "option '$1' requires an argument"
> +fi
> +}
>  
> -while true; do
> -case "$1" in
> +while [ $# -gt 0 ]; do
> +opt="$1"
> +shift
> +case "$opt" in
>   -d)
>   LXC_DROP_CAPS="yes"
> - shift
>   ;;
>   -h|--help)
>   help
>   exit 0
>   ;;
>   --)
> - shift
>   break
>   ;;
> - *)
> +-?)
> +usage_err "unknown option '$opt'"
> +;;
> +-*)
> +# split opts -abc into -a -b -c
> +set -- $(echo "${opt#-}" | sed 's/\(.\)/ -\1/g') "$@"
> +;;
> + *)
>   usage
>   exit 1
>   ;;
> 


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



signature.asc
Description: OpenPGP digital signature
--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] [PATCH] Oracle template: make container also boot under libvirt

2012-11-27 Thread Dwight Engen
This allows containers created with lxc-create to also boot under
libvirt/Virtual Machine Monitor

Signed-off-by: Dwight Engen 
---
 templates/lxc-oracle.in |   21 +
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
index 6e11d99..b9fdac1 100644
--- a/templates/lxc-oracle.in
+++ b/templates/lxc-oracle.in
@@ -63,10 +63,10 @@ container_rootfs_configure()
 else
echo "SELINUX=disabled" >$container_rootfs/etc/selinux/config
 fi
-if [ $container_release_major = "5" ]; then
-   sed -i 's|session[ ]*required[ ]*pam_selinux.so[ ]*close|#session 
required pam_selinux.so close|' $container_rootfs/etc/pam.d/login
-   sed -i 's|session[ ]*required[ ]*pam_selinux.so[ ]*open|#session 
required pam_selinux.so open|' $container_rootfs/etc/pam.d/login
-fi
+sed -i 's|session[ ]*required[ ]*pam_selinux.so[ ]*close|#session required 
pam_selinux.so close|' $container_rootfs/etc/pam.d/login
+sed -i 's|session[ ]*required[ ]*pam_selinux.so[ ]*open|#session required 
pam_selinux.so open|' $container_rootfs/etc/pam.d/login
+sed -i 's|session[ ]*required[ ]*pam_loginuid.so|#session required 
pam_loginuid.so|' $container_rootfs/etc/pam.d/login
+
 
 # configure the network to use dhcp. we set DHCP_HOSTNAME so the guest
 # will report its name and be resolv'able by the hosts dnsmasq
@@ -96,9 +96,12 @@ EOF
 echo "blacklist net-pf-10" 
>>$container_rootfs/etc/modprobe.d/blacklist.conf
 rm -f $container_rootfs/etc/sysconfig/network-scripts/init.ipv6-global
 
+# this file has to exist for libvirt/Virtual machine monitor to boot the 
container
+touch $container_rootfs/etc/mtab
+
+# don't put devpts in here, it will already be mounted for us by 
lxc/libvirt
 cat < $container_rootfs/etc/fstab
 proc/proc proc   nodev,noexec,nosuid 0 0
-devpts  /dev/pts  devpts defaults 0 0
 sysfs   /sys  sysfs  defaults 0 0
 EOF
 
@@ -151,13 +154,15 @@ EOF
 # lxc will maintain these links and bind mount ptys over /dev/lxc/*
 # since lxc.devttydir is specified in the config.
 
-# allow root login on console and tty[1-4]
+# allow root login on console, tty[1-4], and pts/0 for libvirt
 echo "# LXC (Linux Containers)" >>$container_rootfs/etc/securetty
 echo "lxc/console" >>$container_rootfs/etc/securetty
 echo "lxc/tty1">>$container_rootfs/etc/securetty
 echo "lxc/tty2">>$container_rootfs/etc/securetty
 echo "lxc/tty3">>$container_rootfs/etc/securetty
 echo "lxc/tty4">>$container_rootfs/etc/securetty
+echo "# For libvirt/Virtual Machine Monitor" 
>>$container_rootfs/etc/securetty
+echo "pts/0">>$container_rootfs/etc/securetty
 
 # dont try to unmount /dev/lxc devices
 sed -i 's|&& $1 !~ /^\\/dev\\/ram/|\&\& $2 !~ /^\\/dev\\/lxc/ \&\& $1 !~ 
/^\\/dev\\/ram/|' $container_rootfs/etc/init.d/halt
@@ -201,7 +206,8 @@ EOF
chroot $container_rootfs chkconfig 2>/dev/null $service on
 done
 
-# create required devices
+# create required devices. note that /dev/console will be created by lxc
+# or libvirt itself to be a symlink to the right pty.
 # take care to not nuke /dev in case $container_rootfs isn't set
 dev_path="$container_rootfs/dev"
 if [ $container_rootfs != "/" -a -d $dev_path ]; then
@@ -220,7 +226,6 @@ EOF
 mknod -m 666  $dev_path/tty2 c 4 2
 mknod -m 666  $dev_path/tty3 c 4 3
 mknod -m 666  $dev_path/tty4 c 4 4
-mknod -m 600  $dev_path/console c 5 1
 mknod -m 666  $dev_path/full c 1 7
 mknod -m 600  $dev_path/initctl p
 
-- 
1.7.1


--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


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

2012-11-27 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com):
> This makes it easier to write a binding, and presents a cleaner API. Use
> strdupa in a few places to get mutable strings for tokenizing / parsing.
> Also change the argv type in lxcapi_start and lxcapi_create to match
> that of execv(3).
> 
> Signed-off-by: Dwight Engen 

Thanks.

Acked-by: Serge E. Hallyn 

--
Keep yourself connected to Go Parallel: 
DESIGN Expert tips on starting your parallel project right.
http://goparallel.sourceforge.net
___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


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

2012-11-27 Thread Stéphane Graber
On 11/27/2012 02:23 PM, Serge Hallyn wrote:
> Quoting Dwight Engen (dwight.en...@oracle.com):
>> This makes it easier to write a binding, and presents a cleaner API. Use
>> strdupa in a few places to get mutable strings for tokenizing / parsing.
>> Also change the argv type in lxcapi_start and lxcapi_create to match
>> that of execv(3).
>>
>> Signed-off-by: Dwight Engen 
> 
> Thanks.
> 
> Acked-by: Serge E. Hallyn 

And applied to staging.

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



signature.asc
Description: OpenPGP digital signature
--
Keep yourself connected to Go Parallel: 
DESIGN Expert tips on starting your parallel project right.
http://goparallel.sourceforge.net___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


Re: [lxc-devel] [PATCH] Oracle template: make container also boot under libvirt

2012-11-27 Thread Stéphane Graber
On 11/27/2012 11:07 AM, Dwight Engen wrote:
> This allows containers created with lxc-create to also boot under
> libvirt/Virtual Machine Monitor
> 
> Signed-off-by: Dwight Engen 

Acked-by: Stéphane Graber 

Applied to staging. Thanks!

> ---
>  templates/lxc-oracle.in |   21 +
>  1 files changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
> index 6e11d99..b9fdac1 100644
> --- a/templates/lxc-oracle.in
> +++ b/templates/lxc-oracle.in
> @@ -63,10 +63,10 @@ container_rootfs_configure()
>  else
>   echo "SELINUX=disabled" >$container_rootfs/etc/selinux/config
>  fi
> -if [ $container_release_major = "5" ]; then
> - sed -i 's|session[ ]*required[ ]*pam_selinux.so[ ]*close|#session 
> required pam_selinux.so close|' $container_rootfs/etc/pam.d/login
> - sed -i 's|session[ ]*required[ ]*pam_selinux.so[ ]*open|#session 
> required pam_selinux.so open|' $container_rootfs/etc/pam.d/login
> -fi
> +sed -i 's|session[ ]*required[ ]*pam_selinux.so[ ]*close|#session 
> required pam_selinux.so close|' $container_rootfs/etc/pam.d/login
> +sed -i 's|session[ ]*required[ ]*pam_selinux.so[ ]*open|#session 
> required pam_selinux.so open|' $container_rootfs/etc/pam.d/login
> +sed -i 's|session[ ]*required[ ]*pam_loginuid.so|#session required 
> pam_loginuid.so|' $container_rootfs/etc/pam.d/login
> +
>  
>  # configure the network to use dhcp. we set DHCP_HOSTNAME so the guest
>  # will report its name and be resolv'able by the hosts dnsmasq
> @@ -96,9 +96,12 @@ EOF
>  echo "blacklist net-pf-10" 
> >>$container_rootfs/etc/modprobe.d/blacklist.conf
>  rm -f $container_rootfs/etc/sysconfig/network-scripts/init.ipv6-global
>  
> +# this file has to exist for libvirt/Virtual machine monitor to boot the 
> container
> +touch $container_rootfs/etc/mtab
> +
> +# don't put devpts in here, it will already be mounted for us by 
> lxc/libvirt
>  cat < $container_rootfs/etc/fstab
>  proc/proc proc   nodev,noexec,nosuid 0 0
> -devpts  /dev/pts  devpts defaults 0 0
>  sysfs   /sys  sysfs  defaults 0 0
>  EOF
>  
> @@ -151,13 +154,15 @@ EOF
>  # lxc will maintain these links and bind mount ptys over /dev/lxc/*
>  # since lxc.devttydir is specified in the config.
>  
> -# allow root login on console and tty[1-4]
> +# allow root login on console, tty[1-4], and pts/0 for libvirt
>  echo "# LXC (Linux Containers)" >>$container_rootfs/etc/securetty
>  echo "lxc/console"   >>$container_rootfs/etc/securetty
>  echo "lxc/tty1"  >>$container_rootfs/etc/securetty
>  echo "lxc/tty2"  >>$container_rootfs/etc/securetty
>  echo "lxc/tty3"  >>$container_rootfs/etc/securetty
>  echo "lxc/tty4"  >>$container_rootfs/etc/securetty
> +echo "# For libvirt/Virtual Machine Monitor" 
> >>$container_rootfs/etc/securetty
> +echo "pts/0">>$container_rootfs/etc/securetty
>  
>  # dont try to unmount /dev/lxc devices
>  sed -i 's|&& $1 !~ /^\\/dev\\/ram/|\&\& $2 !~ /^\\/dev\\/lxc/ \&\& $1 !~ 
> /^\\/dev\\/ram/|' $container_rootfs/etc/init.d/halt
> @@ -201,7 +206,8 @@ EOF
>   chroot $container_rootfs chkconfig 2>/dev/null $service on
>  done
>  
> -# create required devices
> +# create required devices. note that /dev/console will be created by lxc
> +# or libvirt itself to be a symlink to the right pty.
>  # take care to not nuke /dev in case $container_rootfs isn't set
>  dev_path="$container_rootfs/dev"
>  if [ $container_rootfs != "/" -a -d $dev_path ]; then
> @@ -220,7 +226,6 @@ EOF
>  mknod -m 666  $dev_path/tty2 c 4 2
>  mknod -m 666  $dev_path/tty3 c 4 3
>  mknod -m 666  $dev_path/tty4 c 4 4
> -mknod -m 600  $dev_path/console c 5 1
>  mknod -m 666  $dev_path/full c 1 7
>  mknod -m 600  $dev_path/initctl p
>  
> 


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



signature.asc
Description: OpenPGP digital signature
--
Keep yourself connected to Go Parallel: 
DESIGN Expert tips on starting your parallel project right.
http://goparallel.sourceforge.net___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel