Comment 4 for bug 1629824

Revision history for this message
Stéphane Graber (stgraber) wrote : Re: [Bug 1629824] Re: lxd should explicitly create "containers" and "images" datasets on ZFS

On Tue, Oct 04, 2016 at 02:22:45AM -0000, Richard Laager wrote:
> > The fact that LXD doesn't put /var/lib/lxd itself in the ZFS pool is
> > intentional.
>
> I wasn't suggesting that in the general case. Creating a dataset at
> /var/lib/lxd has more to do with the root-on-ZFS setup, and is
> independent of where to place the lxd storage pool(s). I can see how
> that's distracting. Let's ignore that.
>
> The mountpoint problem exists just the same in this scenario:
> truncate -s 10G /var/lib/pool.img
> zpool create pool /var/lib/pool.img
> apt install lxd
> lxd init
> # Specify "no" to creating a pool, and "pool" as the existing dataset.
> # Accept the rest of the defaults.
> lxd launch ubuntu:
>
> You'll end up with /pool/containers and /pool/images mounted.

Sure, but had you created the exact same thing through "lxd init" you'd
have been fine.

If the user manually creates a pool, it's their responsability to pass -m none.

>
> > If you opt into using a subset of an existing pool, we assume you know
> > what you're doing and that you will properly configure it prior to
> > giving it to LXD (LXD won't create it for you so you kinda have to).
>
> It's true that the admin has to create the pool first. But they do not
> have to create the datasets for lxd to work. lxd will implicitly create
> the containers and images datasets through the use of `zfs create -p
> POOL/containers/foo".
>
> I'm suggesting this change (untested):
> https://github.com/rlaager/lxd/commit/7c9f79c9451fad646c533fc6bb5ea3e67535eab8

I'd probably just have LXD force set mountpoint=none for whatever
dataset its root is at and let the rest inherit.

That wouldn't be quite enough, LXD creates a number of other paths when
archiving images, mounting snapshots, doing live migration, ...

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