[while the goal of this experiment is to use a ZFS filer with
Ganeti, some might find it a bit off topic - let me know if
you do and I'll take it off-list]
candlerb (b.candler) writes:
>
> With nfs4, you might be able to have a single /export directory, have all
> the zfs filesystems mounted under there, and export the whole thing. Or
> bind-mount all the zfs filesystems under a single export point.
Ok, the latter doesn't seem to work very well.
I have, on an NFS server (FreeBSD):
/zroot/vms/a
/zroot/vms/b
/zroot/vms/c
/zroot/vms/d
... each of these ZFS FSes contains a single dummy image
a.img, b.img, etc...
I have then mount_nullfs'ed them all as follows:
mount_nullfs /zroot/vms/a /nfs/a
mount_nullfs /zroot/vms/b /nfs/b
mount_nullfs /zroot/vms/c /nfs/c
mount_nullfs /zroot/vms/d /nfs/d
... and exported them using nfs:
/nfs -maproot=0:0 -network 10.10.0.0 -mask 255.255.0.0
(This is on the FreeBSD server).
On the Linux server:
mount -o nfsvers=3 10.10.0.133:/nfs /nfs
then:
root# ls -l /nfs/
total 2
drwxr-xr-x 2 root root 2 Nov 9 00:15 a
drwxr-xr-x 2 root root 2 Nov 9 00:15 b
drwxr-xr-x 2 root root 2 Nov 9 00:15 c
drwxr-xr-x 2 root root 2 Nov 9 00:15 d
Ok, so far so good:
root# ls -l /nfs/a
total 0
Oops, seems nullfs re-exporting isn't DTRT. Could be that mount_nullfs
is aware this is being NFS exported. Now, it might work with bind mount
on Linux, but I haven't tried.
Much more interesting is using NFSv4.
On the server, /etc/exports is set up as:
V4: /
/zroot/vms -network 10.10.0.0 -mask 255.255.0.0
/zroot/vms/a -network 10.10.0.0 -mask 255.255.0.0
/zroot/vms/d -network 10.10.0.0 -mask 255.255.0.0
Notice I only explicitly export a and d.
On the Linux client, /etc/fstab
10.10.0.133:/zroot/vms /vms nfs nfsvers=4 0 0
Then
root# mkdir /vms
root# mount /vms
root# df -t nfs
Filesystem 1K-blocks Used Available Use% Mounted on
10.10.0.133:/zroot/vms 48171520 0 48171520 0% /vms
root# ls -l /vms/
total 2
drwxr-xr-x 2 nobody 4294967294 3 Nov 8 23:40 a
drwxr-xr-x 2 nobody 4294967294 3 Nov 8 23:40 b
drwxr-xr-x 2 nobody 4294967294 3 Nov 8 23:41 c
drwxr-xr-x 2 nobody 4294967294 3 Nov 9 00:09 d
Ok, looking good.
root# ls -l /vms/a
total 1
-rw-r--r-- 1 nobody 4294967294 0 Nov 8 23:40 a.img
root# df -t nfs
Filesystem 1K-blocks Used Available Use% Mounted on
10.10.0.133:/zroot/vms 48171520 0 48171520 0% /vms
10.10.0.133:/zroot/vms/a 48171520 0 48171520 0% /vms/a
Notice how the client dynamically cross-mounted vms/a
root@dnshost:/# ls -l /vms/b
ls: reading directory '/vms/b': Input/output error
total 0
Argh.
root# ls -l /vms/d
total 1
-rw-r--r-- 1 nobody 4294967294 0 Nov 9 00:09 d.img
So, while the client dynamically mounts sub-FSes, mountd on the server
needs to be told to export the FSes as they are created, then a "service mountd
reload" needs to be issued, otherwise attempts to access the mounted sub-FS
results in I/O error.
Not too critical I guess, but wish there was a v4 equivalent of "-alldirs"
here.
I will be experimenting a bit more with this, and see if I can cobble together
a storage provider on this. Ideally shared-file-storage could be used, but
then there's no hook to create the server-side exports line needed.
Probably can reuse
https://code.grnet.gr/projects/extstorage/repository/revisions/master/show/shared-filer
Finally, since all disks for an instance will be created under the same
directory (one per instance), snapshotting granularity will be all
disks or nothing.