[lxc-devel] [PATCH] lxc-ubuntu-cloud: various small changes
Scott Moser
smoser at ubuntu.com
Thu Jan 30 14:11:24 UTC 2014
On Thu, 30 Jan 2014, Stéphane Graber wrote:
> On Wed, Jan 29, 2014 at 02:37:03PM -0500, Scott Moser wrote:
> > * ppc64el images now exist and generally function.
> > Instead of failing because an arch isnt in the list,
> > let that check happen by ability to download something.
> > * update the hard coded ubuntu releases to know about 'trusty'
> > * shorten the logic that decides if host and container arch
> > are supported.
> > * update usage to reference 'tryreleased' as the default 'stream'
> > * give good error message if user tries 'released' and there
> > is no released version available.
> >
> > Signed-off-by: Scott Moser <smoser at ubuntu.com>
> > ---
> > templates/lxc-ubuntu-cloud.in | 42 ++++++++++++++----------------------------
> > 1 file changed, 14 insertions(+), 28 deletions(-)
> >
> > diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in
> > index 42ee563..9f8cb95 100644
> > --- a/templates/lxc-ubuntu-cloud.in
> > +++ b/templates/lxc-ubuntu-cloud.in
> > @@ -25,6 +25,7 @@ STATE_DIR="@LOCALSTATEDIR@"
> > HOOK_DIR="@LXCHOOKDIR@"
> > CLONE_HOOK_FN="$HOOK_DIR/ubuntu-cloud-prep"
> > LXC_TEMPLATE_CONFIG="@LXCTEMPLATECONFIG@"
> > +KNOWN_RELEASES="lucid natty oneiric precise quantal raring saucy trusty"
>
> Let's drop natty, oneiric and raring from there, they aren't supported anymore.
Generally disagree.
>
> >
> > if [ -r /etc/default/lxc ]; then
> > . /etc/default/lxc
> > @@ -136,7 +137,7 @@ Generic Options
> > [ -a | --arch ]: Architecture of container, defaults to host architecture
> > [ -T | --tarball ]: Location of tarball
> > [ -d | --debug ]: Run with 'set -x' to debug errors
> > -[ -s | --stream]: Use specified stream rather than 'released'
> > +[ -s | --stream]: Use specified stream rather than 'tryreleased'
> >
> > Additionally, clone hooks can be passed through (ie, --userdata). For those,
> > see:
> > @@ -158,7 +159,7 @@ release=precise
> > if [ -f /etc/lsb-release ]; then
> > . /etc/lsb-release
> > rels=$(ubuntu-distro-info --supported 2>/dev/null) ||
> > - rels="lucid natty oneiric precise quantal raring saucy"
> > + rels="$KNOWN_RELEASES"
> > for r in $rels; do
> > [ "$DISTRIB_CODENAME" = "$r" ] && release="$r"
> > done
> > @@ -226,31 +227,12 @@ if [ "$arch" = "i686" ]; then
> > arch=i386
> > fi
> >
> > -if [ $arch != "i386" -a $arch != "amd64" -a $arch != "armhf" -a $arch != "armel" ]; then
> > - echo "Only i386, amd64, armel and armhf are supported by the ubuntu cloud template."
> > - exit 1
> > -fi
> > -
> > -if [ $hostarch != "i386" -a $hostarch != "amd64" -a $hostarch != "armhf" -a $hostarch != "armel" ]; then
> > - echo "Only i386, amd64, armel and armhf are supported as host."
> > - exit 1
> > -fi
> > -
> > -if [ $hostarch = "amd64" -a $arch != "amd64" -a $arch != "i386" ]; then
> > - echo "can't create $arch container on $hostarch"
> > - exit 1
> > -fi
> > -
> > -if [ $hostarch = "i386" -a $arch != "i386" ]; then
> > - echo "can't create $arch container on $hostarch"
> > - exit 1
> > -fi
> > -
> > -if [ $hostarch = "armhf" -o $hostarch = "armel" ] && \
> > - [ $arch != "armhf" -a $arch != "armel" ]; then
> > - echo "can't create $arch container on $hostarch"
> > - exit 1
> > -fi
> > +case "$hostarch:$arch" in
> > + $arch:$arch) : ;; # the host == container
> > + amd64:i386|armhf:armel|armel:armhf) :;; # supported "cross"
> > + *) echo "cannot create '$arch' container on hostarch '$hostarch'";
> > + exit 1;;
> > +esac
>
> Can you also include arm64:armel and arm64:armhf? We may not have cloud
> images for arm64 but if we start having those in the next 5 years,
> having that code will save us some work then (SRU, ...).
Well, i generally think the "I'm smarter than you" approach is wrong here.
Better would be to do what the user said to do, possibly warning.
Can I just remove the whole thing?
Also, fwiw, this is just "create", which *will* work. start may or may
not.
More information about the lxc-devel
mailing list