Changes from the initial version:
- Update docs/schemas and docs/storage.html.in with ZFS backend
information
- Drop StartPool and StopPool that does nothing and therefore
not needed
- Fix memory leak in 'tokens' variable
- Fill volume key before creating a volume
- Use volume's target.path as a key
- Allow not to specify 'target' for pool because in any case
it should be /dev/zvol/$poolname
Few notes on Linux support:
I've been playing around with
http://zfsonlinux.org/. I noticed it
missed '-H' switch to provide a machine-friendly output and
created a feature request:
https://github.com/zfsonlinux/zfs/issues/2522
It was quickly fixed, so I've updated from the git version and moved on.
From that point it worked well and the only thing I had to modify is
not to pass 'volmode' parameter during volume creation (it's freebsd
specific
and it could be e.g. just cdev or a FreeBSD geom provider).
So, basically, for the current (limited) feature set the two things
need to be checked on Linux:
- zpool get support for -H switch
- zfs volmode support for volume creation
I'm open for suggestions what would be a good way to check it. For the '-H'
thing, I was thinking about calling just 'zpool get -H' in StartPool. If
the error says 'invalid option 'H'' (i.e. check if it just contains
'H'), then
return an error that zfs version is too old. That's fragile, but probably
less fragile than parsing usage that looks like that:
usage:
get [-pH] <"all" | property[,...]> <pool> ...
As for the 'volmode', it's simple in terms of parsing, because e.g. 'zfs
get' prints
a nice set of parameters e.g.:
volblocksize NO YES 512 to 128k, power of 2
volmode YES YES default | geom | dev | none
volsize YES NO <size>
So it should not be a problem to check it once and save in some sort of state struct
inside of the ZFS backend.
Roman Bogorodskiy (1):
storage: ZFS support
configure.ac | 43 +++++
docs/schemas/storagepool.rng | 20 +++
docs/storage.html.in | 34 ++++
include/libvirt/libvirt.h.in | 1 +
po/POTFILES.in | 1 +
src/Makefile.am | 8 +
src/conf/storage_conf.c | 15 +-
src/conf/storage_conf.h | 4 +-
src/qemu/qemu_conf.c | 1 +
src/storage/storage_backend.c | 6 +
src/storage/storage_backend_zfs.c | 329 ++++++++++++++++++++++++++++++++++++++
src/storage/storage_backend_zfs.h | 29 ++++
src/storage/storage_driver.c | 1 +
tools/virsh-pool.c | 3 +
14 files changed, 492 insertions(+), 3 deletions(-)
create mode 100644 src/storage/storage_backend_zfs.c
create mode 100644 src/storage/storage_backend_zfs.h
--
1.9.0