Re: [lxc-devel] [PATCH] display warning when yum missing in fedora template

2012-10-05 Thread Stéphane Graber
On 10/04/2012 01:12 PM, Dwight Engen wrote:
> This early exit is preventing the warning message that follows it from
> being shown.
> 
> Signed-off-by: Dwight Engen 
> ---
>  templates/lxc-fedora.in |1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
> index 0bcb396..edd4b9d 100644
> --- a/templates/lxc-fedora.in
> +++ b/templates/lxc-fedora.in
> @@ -354,7 +354,6 @@ needed_pkgs=""
>  type yum >/dev/null 2>&1
>  if [ $? -ne 0 ]; then
>  needed_pkgs="yum $needed_pkgs"
> -exit 1
>  fi
>  
>  type curl >/dev/null 2>&1


Looks good, applied to staging.


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



signature.asc
Description: OpenPGP digital signature
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


Re: [lxc-devel] [PATCH v3] Add Oracle Linux template

2012-10-05 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com):
> 
> This is a new template to create containers based on Oracle Linux. A version
> such as 5.8, 6.3, or 6.latest can be specified with -R in which case a rootfs
> will be created from rpms downloaded from the Oracle public-yum repo.
> Alternatively the path to an existing rootfs of Oracle 5 or 6 may be given to
> the template with the -t option.
> 
> The architecture of the downloaded rpms installed in the container can be
> specified with the -a template option.
> 
> Signed-off-by: Dwight Engen 

Thanks, Dwight - I'd actually pushed this to my staging branch and a bzr
branch, but then I noticed one thing:

> ---
>  configure.ac|1 +
>  templates/Makefile.am   |1 +
>  templates/lxc-oracle.in |  496 
> +++
>  3 files changed, 498 insertions(+), 0 deletions(-)
>  create mode 100644 templates/lxc-oracle.in
> 
> diff --git a/configure.ac b/configure.ac
> index 4bbfd9b..d0535f7 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -197,6 +197,7 @@ AC_CONFIG_FILES([
>   templates/lxc-opensuse
>   templates/lxc-busybox
>   templates/lxc-fedora
> + templates/lxc-oracle
>   templates/lxc-altlinux
>   templates/lxc-sshd
>   templates/lxc-archlinux
> diff --git a/templates/Makefile.am b/templates/Makefile.am
> index d6b3892..523498d 100644
> --- a/templates/Makefile.am
> +++ b/templates/Makefile.am
> @@ -7,6 +7,7 @@ templates_SCRIPTS = \
>   lxc-ubuntu-cloud \
>   lxc-opensuse \
>   lxc-fedora \
> + lxc-oracle \
>   lxc-altlinux \
>   lxc-busybox \
>   lxc-sshd \
> diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
> new file mode 100644
> index 000..e13f13b
> --- /dev/null
> +++ b/templates/lxc-oracle.in
> @@ -0,0 +1,496 @@
> +#!/bin/bash
> +#
> +# Template script for generating Oracle Enterprise Linux container for LXC
> +# based on lxc-fedora, lxc-ubuntu
> +#
> +# Copyright © 2011 Wim Coekaerts 
> +# Copyright © 2012 Dwight Engen 
> +#
> +# Modified for Oracle Linux 5
> +# Wim Coekaerts 
> +#
> +# Modified for Oracle Linux 6, combined OL5,6 into one template script
> +# Dwight Engen 
> +#
> +# This library is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU Lesser General Public
> +# License as published by the Free Software Foundation; either
> +# version 2.1 of the License, or (at your option) any later version.
> +#
> +# This library is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +# Lesser General Public License for more details.
> +#
> +# You should have received a copy of the GNU Lesser General Public
> +# License along with this library; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> +#
> +
> +# use virbr0 that is setup by default by libvirtd
> +lxc_network_type=veth
> +lxc_network_link=virbr0

This should be taken from a config file (at least if provided), not
overriden in the template.  So for instance, I was (implicitly) using
lxc-create -t oracle -f /etc/lxc/lxc.conf -n o1
where lxc.conf is:

lxc.network.type=veth
lxc.network.link=lxcbr0
lxc.network.flags=up

but the oracle container was set to lxc.network.link=virbr0.  Since I
didn't have libvirt installed, the resulting container fails to start.
When I switch the link over, it starts beautifully.

I'm not sure how you'll want to do it - just not 

rm -f $cfg_dir/config

and then only add a network segment if one hasn't already been
specified?

For now I've pushed your patch unchanged onto github.com/hallyn/lxc
branch staging.oct5.1 (and onto
lp:~serge-hallyn/ubuntu/quantal/lxc/lxc-oracle), but that should be
fixed before being merged into the github.com/lxc/lxc staging branch.

-serge

> +
> +die()
> +{
> +echo "failed: $1"
> +exit 1
> +}
> +
> +is_btrfs_subvolume()
> +{
> +if which btrfs >/dev/null 2>&1 && \
> +   btrfs subvolume list "$1" >/dev/null 2>&1; then
> + return 0
> +fi
> +return 1
> +}
> +
> +# fix up the container_rootfs
> +container_rootfs_configure()
> +{
> +echo "Configuring container for Oracle Linux $container_release_major"
> +
> +# "disable" selinux. init in OL 5 honors /etc/selinux/config. note that
> +# this doesnt actually disable it if it's enabled in the host, since
> +# libselinux::is_selinux_enabled() in the guest will check
> +# /proc/filesystems and see selinuxfs, thus reporting that it is on
> +# (ie. check the output of sestatus in the guest)
> +mkdir -p $container_rootfs/selinux
> +echo 0 > $container_rootfs/selinux/enforce
> +if [ -e $container_rootfs/etc/selinux/config ]; then
> + sed -i 's|SELINUX=enforcing|SELINUX=disabled|' 
> $container_rootfs/etc/selinux/config
> +else
> + echo "SELINUX=disabled" >$container_