From: Bruce Ashfield <bruce.ashfield@windriver.com>
To: Yang Shi <yang.shi@windriver.com>,
<meta-virtualization@yoctoproject.org>
Subject: Re: [PATCH] lxc: Tweak lxc template script for systemd/sysvinit
Date: Wed, 15 Oct 2014 14:13:46 -0400 [thread overview]
Message-ID: <543EB95A.4000105@windriver.com> (raw)
In-Reply-To: <1413344463-30106-1-git-send-email-yang.shi@windriver.com>
On 14-10-14 11:41 PM, Yang Shi wrote:
> Tweak the script to make it work for both systemd and sysvinit.
>
> Add "-i <init_method>" parameter. If sysvinit guest is used, "-i sysvinit" need
> to be passed. The default init is systemd.
>
> The below systemd specific changes are added:
> Add "lxc.autodev=1" since LXC will create its own device tree.
> Add "lxc.kmsg=0" to prevent lxc symlinks /dev/kmsg to /dev/console, this leads
> to journald running 100% cpu usage all the time.
> Remove unnecessary mount entry in fstab.
This is definitely good information, and worth the broadcast. I was
asking for any systemd changes that may be floating around, but since
we are patching code that isn't already part of meta-virt, we'll let
this sit and see if any of the dependencies are also available to merge.
Cheers,
Bruce
>
> Signed-off-by: Yang Shi <yang.shi@windriver.com>
> ---
> templates/lxc-wrlinux.in | 31 ++++++++++++++++++++++++++-----
> 1 file changed, 26 insertions(+), 5 deletions(-)
>
> diff --git a/templates/lxc-wrlinux.in b/templates/lxc-wrlinux.in
> index 1ef512b..7775cf2 100644
> --- a/templates/lxc-wrlinux.in
> +++ b/templates/lxc-wrlinux.in
> @@ -30,8 +30,10 @@ default_profile=default
>
> configure_wrlinux()
> {
> - # Tweak initscripts
> - sed -i 's/^\(si::sysinit:\/etc\/init.d\/rcS\)/# \1/' ${rootfs_path}/etc/inittab
> + if [ "${init_method}" == "sysvinit" ]; then
> + # Tweak initscripts
> + sed -i 's/^\(si::sysinit:\/etc\/init.d\/rcS\)/# \1/' ${rootfs_path}/etc/inittab
> + fi
>
> # Touch file for fastboot
> dev_path="${rootfs_path}/dev"
> @@ -78,9 +80,11 @@ copy_configuration()
>
> mkdir -p $config_path
> grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config
> +
> + if [ "${init_method}" == "sysvinit" ]; then
> cat <<EOF >> $config_path/config
> lxc.utsname = $name
> -lxc.tty = 6
> +lxc.tty = 6
> lxc.pts = 1024
> lxc.mount = $config_path/fstab
> EOF
> @@ -91,6 +95,21 @@ none $rootfs_path/sys sysfs defaults 0 0
> none $rootfs_path/dev/pts devpts defaults 0 0
> none $rootfs_path/dev/shm tmpfs defaults 0 0
> EOF
> + # systemd
> + else
> + cat <<EOF >> $config_path/config
> +lxc.utsname = $name
> +lxc.autodev=1
> +lxc.kmsg=0
> +lxc.tty = 6
> +lxc.pts = 1024
> +lxc.mount = $config_path/fstab
> +EOF
> +
> + cat <<EOF > $config_path/fstab
> +none $rootfs_path/sys sysfs defaults 0 0
> +EOF
> + fi
>
> if [ $? -ne 0 ]; then
> echo "Failed to add configuration"
> @@ -110,17 +129,18 @@ usage()
> cat <<EOF
> usage:
> $1 -n|--name=<container_name>
> - [-p|--path=<path>] [-h|--help]
> + [-p|--path=<path>] [-i|--init=<init_method>] [-h|--help]
> Mandatory args:
> -n,--name container name, used to as an identifier for that container from now on
> Optional args:
> -p,--path path to where the container rootfs will be created, defaults to @LXCPATH@. The container config will go under @LXCPATH@ in that case
> + -i,--init init method used by system, systemd or sysvinit
> -h,--help print this help
> EOF
> return 0
> }
>
> -options=$(getopt -o hp:n: -l help,path:,name: -- "$@")
> +options=$(getopt -o hp:n:i: -l help,path:,name:,init: -- "$@")
> if [ $? -ne 0 ]; then
> usage $(basename $0)
> exit 1
> @@ -133,6 +153,7 @@ do
> -h|--help) usage $0 && exit 0;;
> -p|--path) path=$2; shift 2;;
> -n|--name) name=$2; shift 2;;
> + -i|--init) init_method=$2; shift 2;;
> --) shift 1; break ;;
> *) break ;;
> esac
>
prev parent reply other threads:[~2014-10-15 18:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 3:41 [PATCH] lxc: Tweak lxc template script for systemd/sysvinit Yang Shi
2014-10-15 18:13 ` Bruce Ashfield [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=543EB95A.4000105@windriver.com \
--to=bruce.ashfield@windriver.com \
--cc=meta-virtualization@yoctoproject.org \
--cc=yang.shi@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.