[lxc-devel] [PATCH v2] Add Oracle Linux template

Dwight Engen dwight.engen at oracle.com
Thu Oct 4 17:53:33 UTC 2012


On Tue, 2 Oct 2012 09:56:17 -0500
Serge Hallyn <serge.hallyn at canonical.com> wrote:

> Quoting Dwight Engen (dwight.engen at oracle.com):
> > On Tue, 2 Oct 2012 09:16:22 -0500
> > Serge Hallyn <serge.hallyn at canonical.com> wrote:
> > 
> > > Quoting Dwight Engen (dwight.engen at oracle.com):
> > > > On Mon, 1 Oct 2012 12:27:16 -0500
> > > > Serge Hallyn <serge.hallyn at canonical.com> wrote:
> > > > 
> > > > > Quoting Dwight Engen (dwight.engen at oracle.com):
> > > > > > 
> > > > > > This is a new template to create containers based on an
> > > > > > Oracle Linux rootfs image. The path to the rootfs must be
> > > > > > given to the template, and if it resides on a btrfs will be
> > > > > > snapshoted rather than copied.
> > > > > > 
> > > > > > Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
> > > > > 
> > > > > Hi,
> > > > > 
> > > > > maybe it's in here and I'm missing it, but where is the
> > > > > $template_rootfs to come from?  Is there a repository online
> > > > > where they can be fetched? If so, can auto-wget'ing be added
> > > > > to the template?
> > > > > 
> > > > > -serge
> > > > 
> > > > $template_rootfs is a required template argument, so you have to
> > > > give -- -t /path/to/templaterootfs to lxc-create. The idea is
> > > > that you have a rootfs already created/extracted into a btrfs
> > > > subvolume that then gets snapshoted into the container instance
> > > > each time you do an lxc-create. I think this is similar to the
> > > > ubuntu-cloud template, but the
> > > 
> > > The ubuntu-cloud template takes that as an optional argument, and
> > > will automatically wget the tarball if it doesn't exist.  That's
> > > what I was suggesting that you do.
> > > 
> > > And to be clear I'm not saying inclusion of the template upstream
> > > ought to block on that.
> > 
> > Yeah, so thats what I'm doing too is to make the -t optional, and
> > if you don't give it, it will download and create a rootfs from
> > rpms. That way users can create the rootfs themselves or specify a
> > -R release to have the template make one for them.
> > 
> > > > template doesn't do the fetching and setup of the template
> > > > rootfs.
> > > > 
> > > > I can look into setting up the template rootfs from rpms, or an
> > > > image if that is required, but I think its useful also for the
> > > > template rootfs to be user specifiable as well.
> > > 
> > > Agreed, I have no objection to the option.
> > > 
> > > > How do you handle for example if
> > > > you want one template rootfs to be a webserver, and another one
> > > > for a database? Do you intend for that to be done post
> > > > lxc-create with some configuration management (ala puppet)
> > > > tool? It seems like this would work, but would make bigger
> > > > differences per container instance to the template, so if you
> > > > plan to instantiate many container instances it could add up.
> > > 
> > > (Not saying you should go this route, but) the way I address this
> > > is to create canonical containers (lvm-based though btrfs-based
> > > works too) and then lxc-clone them.
> > 
> > Right, this is I think very similar to what I was going for with the
> > template rootfs. 
> > 
> > > Thanks for the template.
> > 
> > Thanks, I'll post a new patch once I get the rpm download thing
> > working.
> > 
> 
> Great, thanks - I'll push it to the github staging branch as soon as
> you do.
> 
> -serge

I reworked the template so it works more like the other templates (ie.
downloads the release and creates a rootfs). There were a few tricky
things such as fixing up the rpm database because older releases have a
different db version than the host rpm and yum, and being able to
specify the arch requires 'hardcoding' with sed the $basearch in the
yum repo definition. Its working pretty well for me though, I've tested
it with Oracle Linux 5.8 (both i686 and x86_64) and various Oracle
Linux 6.x (both i686 and x86_64).

I did keep the "template rootfs" mode, since I think that will be
useful in certain circumstances, like p2v or converting a
non-container virt image to use with lxc. The only ugly thing about it
is that (on btrfs) lxc-create has already made the containers'
rootfs as a btrfs subvolume, but I actually want it to be a snapshot of
the template, so I just delete it and recreated it as a snapshot. If
someone has a better idea, I'd be happy to hear it.

New patch to follow...




More information about the lxc-devel mailing list