[lxc-devel] [PATCH] Update lxc-archlinux template to work with systemd, use arch-install-scripts for installation

2012-12-13 Thread Alexander Vladimirov
---
 templates/lxc-archlinux.in | 359 +++--
 1 file changed, 84 insertions(+), 275 deletions(-)

diff --git a/templates/lxc-archlinux.in b/templates/lxc-archlinux.in
index cf274d4..53e8e22 100644
--- a/templates/lxc-archlinux.in
+++ b/templates/lxc-archlinux.in
@@ -25,19 +25,19 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 # defaults
-arch=$(arch)
-cache=@LOCALSTATEDIR@/lxc/arch/${arch}
+arch=$(uname -m)
 lxc_network_type="veth"
 lxc_network_link="br0"
-default_path=@LXCPATH@
-default_rc_locale="en-US.UTF-8"
-default_rc_timezone="UTC"
-host_mirror="http://mirrors.kernel.org/archlinux/\$repo/os/$arch";
+default_path="@LXCPATH@"
+default_locale="en-US.UTF-8"
+default_timezone="UTC"
+#host_mirror="http://mirrors.kernel.org/archlinux/\$repo/os/$arch";
 
 # sort of minimal package set
 base_packages=(
+"systemd"
+"systemd-sysvcompat"
 "filesystem"
-"initscripts"
 "coreutils"
 "module-init-tools"
 "procps"
@@ -63,21 +63,6 @@ base_packages=(
 )
 declare -a additional_packages
 
-[ -f /etc/arch-release ] && is_arch=true
-
-# find and extract parameter value from given config file
-# ${1} - file to read parameter from
-# ${2} - parameter name
-# ${result} - result value on success
-function read_parameter_value {
-[ -f ${1} ] && [ "${2}" ] || return 1
-local pattern="^[[:space:]]*${2}[[:space:]]*=[[:space:]]*"
-local str=$(grep "${pattern}" "${1}")
-local str=${str/#$(grep -o "${pattern}" "${1}")/}
-result=${str//\"/}
-return 0
-}
-
 # split comma-separated string into an array
 # ${1} - string to split
 # ${2} - separator (default is ",")
@@ -90,299 +75,122 @@ function split_string {
 return 0
 }
 
+[ -f /etc/arch-release ] && is_arch=true
+
 # Arch-specific preconfiguration for container
 function configure_arch {
 # read locale and timezone defaults from system rc.conf if running on Arch
 if [ "${is_arch}" ]; then
-read_parameter_value "/etc/rc.conf" "LOCALE"
-rc_locale=${result:-${default_rc_locale}}
-read_parameter_value "/etc/rc.conf" "TIMEZONE"
-rc_timezone=${result:-${default_rc_timezone}}
+cp -p /etc/vconsole.conf /etc/locale.conf /etc/locale.gen 
"${rootfs_path}/etc/"
 else
-rc_locale=${default_rc_locale}
-rc_timezone=${default_rc_timezone}
-fi
-
-echo "Setting up rc.conf"
-cat > "${rootfs_path}/etc/rc.conf" << EOF
-# /etc/rc.conf - Main Configuration for Arch Linux
-LOCALE="${rc_locale}"
-DAEMON_LOCALE="no"
-HARDWARECLOCK="local"
-TIMEZONE="${rc_timezone}"
-KEYMAP=us
-CONSOLEFONT=
-CONSOLEMAP=
-USECOLOR="yes"
-MODULES=()
-HOSTNAME="${name}"
-interface=eth0
-address=
-netmask=
-broadcast=
-gateway=
-DAEMONS=(syslog-ng crond network)
+echo "LANG=${default_lang}" > "${rootfs_path}/etc/locale.conf"
+echo "KEYMAP=us" > "${rootfs_path}/etc/vconsole.conf"
+cat > "${rootfs_path}/etc/adjtime" << EOF
+0.0 0.0 0.0
+0
+LOCAL
 EOF
-
-if [ -e "${rootfs_path}/etc/locale.gen" ]; then
-sed -i 's@^#\(en_US\.UTF-8\)@\1@' "${rootfs_path}/etc/locale.gen"
-if [ ! "${rc_locale}" = "en_US.UTF-8" ]; then
-echo "${rc_locale} ${rc_locale##*.}" >> 
"${rootfs_path}/etc/locale.gen"
+if [ -e "${rootfs_path}/etc/locale.gen" ]; then
+sed -i 's@^#\(en_US\.UTF-8\)@\1@' "${rootfs_path}/etc/locale.gen"
+if [ ! "${default_locale}" = "en_US.UTF-8" ]; then
+echo "${default_locale} ${default_locale##*.}" >> 
"${rootfs_path}/etc/locale.gen"
+fi
 fi
-chroot "${rootfs_path}" locale-gen
 fi
-cp "${rootfs_path}/usr/share/zoneinfo/${rc_timezone}" \
-   "${rootfs_path}/etc/localtime"
-
-echo "Setting up rc.sysinit"
-cat > "${rootfs_path}/etc/rc.sysinit.lxc" << EOF
-#!/bin/bash
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-echo "starting Arch Linux"
-rm -f \$(find /var/run -name '*pid')
-rm -f /run/daemons/*
-rm -f /var/lock/subsys/*
-rm -f /etc/mtab
-touch /etc/mtab
-run_hook sysinit_end
-EOF
-
-echo "Setting up rc.shutdown"
-cat > "${rootfs_path}/etc/rc.shutdown.lxc" << EOF
-#!/bin/bash
-. /etc/rc.conf
-. /etc/rc.d/functions
-stty onlcr
-run_hook shutdown_start
-[[ -x /etc/rc.local.shutdown ]] && /etc/rc.local.shutdown
-stop_all_daemons
-run_hook shutdown_prekillall
-kill_all
-run_hook shutdown_postkillall
-[[ \${TIMEZONE} ]] && cp --remove-destination 
"/usr/share/zoneinfo/\${TIMEZONE}" /etc/localtime
-halt -w
-umount -a -r -t nodevtmpfs,notmpfs,nosysfs,noproc,nodevpts -O no_netdev
-run_hook shutdown_postumount
-run_hook shutdown_poweroff
-if [[ \${RUNLEVEL} = 0 ]]; then
-poweroff -d -f -i
-else
-reboot -d -f -i
-fi
-# vim: set ts=2 sw=2 noet:
-EOF
-chmod 755 "${rootfs_path}/etc/rc.shutdown.lxc" 
"${rootfs_path}/etc/rc.sysinit.lxc"
-
-echo "Setting up inittab"
-cat > "${rootfs_path}/etc/inittab" << EOF
-id:3:initdefault:
-rc::sysinit:/etc/rc.sysinit.lxc
-rs:S1:wait:/etc

Re: [lxc-devel] [PATCH] Fix race/corruption with multiple lxc-start, lxc-execute

2012-12-13 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com):
> If you start more than one lxc-start/lxc-execute with the same name at the
> same time, or just do an lxc-start/lxc-execute with the name of a container
> that is already running, lxc doesn't figure out that the container with this
> name is already running until fairly late in the initialization process: ie
> when __lxc_start() -> lxc_poll() -> lxc_command_mainloop_add() attempts to
> create the same abstract socket name.
> 
> By this point a fair amount of initialization has been done that actually
> messes up the running container. For example __lxc_start() -> lxc_spawn() ->
> lxc_cgroup_create() -> lxc_one_cgroup_create() -> try_to_move_cgname() moves
> the running container's cgroup to a name of deadXX.
> 
> The solution in this patch is to use the atomic existence of the abstract
> socket name as the indicator that the container is already running.  To do
> so, I just refactored lxc_command_mainloop_add() into an lxc_command_init()
> routine that attempts to bind the socket, and ensure this is called earlier
> before much initialization has been done.
> 
> In testing, I verified that maincmd_fd was still open at the time of lxc_fini,
> so the entire lifetime of the container's run should be covered. The only
> explicit close of this fd was in the reboot case of lxcapi_start(), which is
> now moved to lxc_fini(), which I think is more appropriate.
> 
> Even though it is not checked any more, set maincmd_fd to -1 instead of 0 to
> indicate its not open since 0 could be a valid fd.
> 
> Signed-off-by: Dwight Engen 

Acked-by: Serge E. Hallyn 

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] [PATCH] Renamed ethX => devN on stop (network phys)

2012-12-13 Thread Vitaly Lavrov
The source of this problem is in linux/net/core/dev.c:default_device_exit()

The problem can be resolved by means of a patch ( for version 0.8.0 )

The patch doesn't solve a problem of disappearance of "dummy", "imq",
"ifb" network devices when closing container ( this is kernel problem
).


lxc_exit_netdev_fix.patch
Description: Binary data
--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] [GIT] lxc tag, lxc-0.9.0.alpha1, created. d984bb4e751121f1a7c0029ee7df4acf62f2eea4

2012-12-13 Thread Daniel Lezcano
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "lxc".

The tag, lxc-0.9.0.alpha1 has been created
at  d984bb4e751121f1a7c0029ee7df4acf62f2eea4 (commit)

- Log -
commit d984bb4e751121f1a7c0029ee7df4acf62f2eea4
Author: Daniel Lezcano 
Date:   Thu Dec 13 21:51:03 2012 +0100

Version 0.9.0.alpha1

Signed-off-by: Daniel Lezcano 
---


hooks/post-receive
-- 
lxc

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


Re: [lxc-devel] LXC 0.9.alpha1 pull request

2012-12-13 Thread Daniel Lezcano
On 12/10/2012 11:36 PM, Stéphane Graber wrote:
> Hi Daniel,
>
> You'll find the 0.9.alpha1 pull request below.
>
> Based on what you had to do last time in Copenhagen, I believe the
> following actions are to be done on your side:
>
>  - Properly tag 0.8, currently we only have a commit but no matching
>tag, this should be fixed before pulling from staging.
>  - Review the pull request
>  - Use "git pull --edit --no-ff --stat git://github.com/lxc/lxc.git",
>that should do a real merge, letting you do a proper Sign-off of the
>changes.
>  - Update the version number to 0.9.alpha1 (the version number format
>is to avoid breaking RPM based distros)
>  - Commit and tag

Pulled and tagged.

Thanks for the contributions !

  -- Daniel


--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


Re: [lxc-devel] LXC 0.9.alpha1 pull request

2012-12-13 Thread Stéphane Graber
On 12/13/2012 03:59 PM, Daniel Lezcano wrote:
> On 12/10/2012 11:36 PM, Stéphane Graber wrote:
>> Hi Daniel,
>>
>> You'll find the 0.9.alpha1 pull request below.
>>
>> Based on what you had to do last time in Copenhagen, I believe the
>> following actions are to be done on your side:
>>
>>  - Properly tag 0.8, currently we only have a commit but no matching
>>tag, this should be fixed before pulling from staging.
>>  - Review the pull request
>>  - Use "git pull --edit --no-ff --stat git://github.com/lxc/lxc.git",
>>that should do a real merge, letting you do a proper Sign-off of the
>>changes.
>>  - Update the version number to 0.9.alpha1 (the version number format
>>is to avoid breaking RPM based distros)
>>  - Commit and tag
> 
> Pulled and tagged.
> 
> Thanks for the contributions !
> 
>   -- Daniel

Thanks for the release.

I have now rebased the staging branch on the master branch and applied
the remaining patches that have been acked since 0.9~alpha1 was released.

So we're now back to business as usual with the next target being
0.9~alpha2 in February.

Feature goals for alpha2 include some more API work as was discussed
here recently along with the system configuration file we discussed a
few days ago. Serge and I will be looking into these, any help is welcome.


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



signature.asc
Description: OpenPGP digital signature
--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel