[lxc-devel] [PATCH] plamo: Update template to use lxc.include and add plamo.common.conf

Serge Hallyn serge.hallyn at ubuntu.com
Mon Jan 13 15:13:49 UTC 2014


Quoting KATOH Yasufumi (karma at jazz.email.ne.jp):
> Signed-off-by: KATOH Yasufumi <karma at jazz.email.ne.jp>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  config/templates/Makefile.am          |  1 +
>  config/templates/plamo.common.conf.in | 26 ++++++++++++++++++++++++++
>  configure.ac                          |  1 +
>  templates/lxc-plamo.in                | 34 ++++++++++++----------------------
>  4 files changed, 40 insertions(+), 22 deletions(-)
>  create mode 100644 config/templates/plamo.common.conf.in
> 
> diff --git a/config/templates/Makefile.am b/config/templates/Makefile.am
> index 6cc045b..f8b9f11 100644
> --- a/config/templates/Makefile.am
> +++ b/config/templates/Makefile.am
> @@ -1,6 +1,7 @@
>  templatesconfigdir=@LXCTEMPLATECONFIG@
>  
>  templatesconfig_DATA = \
> +	plamo.common.conf \
>  	ubuntu-cloud.common.conf \
>  	ubuntu-cloud.lucid.conf \
>  	ubuntu-cloud.userns.conf \
> diff --git a/config/templates/plamo.common.conf.in b/config/templates/plamo.common.conf.in
> new file mode 100644
> index 0000000..50783c3
> --- /dev/null
> +++ b/config/templates/plamo.common.conf.in
> @@ -0,0 +1,26 @@
> +# Default console settings
> +lxc.tty = 4
> +lxc.pts = 1024
> +
> +# Default mount
> +lxc.mount.auto = proc sys cgroup
> +
> +# Default capabilities
> +lxc.cap.drop = sys_module mac_admin mac_override sys_time
> +
> +lxc.cgroup.devices.deny = a
> +# /dev/null and zero
> +lxc.cgroup.devices.allow = c 1:3 rwm
> +lxc.cgroup.devices.allow = c 1:5 rwm
> +# consoles
> +lxc.cgroup.devices.allow = c 5:0 rwm
> +lxc.cgroup.devices.allow = c 5:1 rwm
> +# /dev/{,u}random
> +lxc.cgroup.devices.allow = c 1:8 rwm
> +lxc.cgroup.devices.allow = c 1:9 rwm
> +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
> diff --git a/configure.ac b/configure.ac
> index cbaa38b..5e4324b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -532,6 +532,7 @@ AC_CONFIG_FILES([
>  	config/Makefile
>  	config/etc/Makefile
>  	config/templates/Makefile
> +	config/templates/plamo.common.conf
>  	config/templates/ubuntu-cloud.common.conf
>  	config/templates/ubuntu-cloud.lucid.conf
>  	config/templates/ubuntu-cloud.userns.conf
> diff --git a/templates/lxc-plamo.in b/templates/lxc-plamo.in
> index 8705a05..a40bec7 100644
> --- a/templates/lxc-plamo.in
> +++ b/templates/lxc-plamo.in
> @@ -28,6 +28,8 @@
>  # ref. https://github.com/Ponce/lxc-slackware/blob/master/lxc-slackware
>  #      lxc-ubuntu script
>  
> +LXC_TEMPLATE_CONFIG="@LXCTEMPLATECONFIG@"
> +
>  [ -r /etc/default/lxc ] && . /etc/default/lxc
>  
>  MIRRORSRV=${MIRRORSRV:-"ftp.ne.jp"}
> @@ -243,35 +245,23 @@ configure_plamo() {
>  }
>  
>  copy_configuration() {
> +
> +  # Create the fstab (empty by default)
> +  touch $path/fstab
> +
>    if ! cat <<- EOF >> $path/config ; then
>  	lxc.utsname = $name
> -	
> -	lxc.tty = 4
> -	lxc.pts = 1024
> -	lxc.mount.auto = proc sys cgroup
>  	lxc.arch = $arch
> -	lxc.cap.drop = sys_module mac_admin mac_override sys_time
> -	
> -	lxc.cgroup.devices.deny = a
> -	# /dev/null and zero
> -	lxc.cgroup.devices.allow = c 1:3 rwm
> -	lxc.cgroup.devices.allow = c 1:5 rwm
> -	# consoles
> -	lxc.cgroup.devices.allow = c 5:0 rwm
> -	lxc.cgroup.devices.allow = c 5:1 rwm
> -	# /dev/{,u}random
> -	lxc.cgroup.devices.allow = c 1:8 rwm
> -	lxc.cgroup.devices.allow = c 1:9 rwm
> -	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
> +	lxc.mount = $path/fstab
>  	EOF
>      echo "Failed to add configuration."
>      return 1
>    fi
> +
> +  if [ -e "${LXC_TEMPLATE_CONFIG}/plamo.common.conf" ] ; then
> +    echo "lxc.include = ${LXC_TEMPLATE_CONFIG}/plamo.common.conf" >> $path/config
> +  fi
> +
>    return 0
>  }
>  
> -- 
> 1.8.3.4 (Apple Git-47)
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list