[lxc-devel] [PATCH] add zfs support to lxc-create and lxc-destroy
Serge Hallyn
serge.hallyn at ubuntu.com
Fri Apr 26 13:49:48 UTC 2013
Quoting Stéphane Graber (stgraber at ubuntu.com):
> On 04/25/2013 10:18 PM, Serge Hallyn wrote:
> > This is based on patch from Papp Tamas (thanks). It also does some
> > reorganizing of lxc-create to commonize some of the backingstore handling.
> >
> > I played with it using:
> >
> > sudo lvcreate -L 100G -n zfs vg0
> > sudo zpool create lxc /dev/vg0/zfs
> > sudo lxc-create -B zfs --zfsroot lxc -t ubuntu -n dir2
> >
> > or you could
> >
> > qemu-img create zfs.img 100G
> > sudo qemu-nbd -c /dev/nbd0 zfs.img
> > sudo zpool create lxc /dev/nbd0
> > sudo lxc-create -B zfs --zfsroot lxc -t ubuntu -n dir2
> >
> > I'll write the bdev.c handler and hook up lxc-clone next.
> >
> > This also fixses a bug in the sed expression to extract the rootfs from
> > container config, which prepended an extra '/' to the rootdev. (That
> > caused the zfs list entry not to match at destroy)
> >
> > Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
> > Cc: Papp Tamas <tompos at martos.bme.hu>
>
> The only potential annoyance I can see is if we ever try to auto-detect
> LVM as it's way more verbose than the other checks and will throw a
> bunch of weird errors to the user who just wanted auto-detect.
Not sure how you envision the autodetect. Note that in bdev.c lvm is
actually detected by looking for 'LVM-' at the start of the block
device. So autodetect for clone and lxc-info and lxc-list will be
silent.
Eventually I'd like to re-write lxc-create with the api as well. Then
the logic at lxc-create will be something like:
1. If backing store is specified on command line, use it
2. If backing store is specified in /etc/lxc/lxc.conf, use it
3. If $lxcpath is btrfs, use btrfs
4. if there is a VG called lxc, use lvm
5. if there is a zfsroot called lxc, use it
-serge
More information about the lxc-devel
mailing list