Dear libguestfs developers, as explained yesterday by Ubuntu guys on my bug report https://bugs.launchpad.net/ubuntu/+source/libguestfs/+bug/1722800 the libguestfs currently supports ZFS filesystem only partially i.e. for virt-rescue. Q: Would it be possible to bring ZFS support also to other libguestfs utils, like guestfish and virt-format? I would need to have two usecases supported: a) create a new volume with ZFS filesystem / format existing volume into ZFS filesystem b) manage files from ZFS volume (read, write) I'm looking forward to be hearing your opinion/plans regarding this. Thank you and Best Regards, Miha
On Thu, Oct 12, 2017 at 09:46:13AM +0200, Miha Pleško wrote:> > Dear libguestfs developers, > > as explained yesterday by Ubuntu guys on my bug report > https://bugs.launchpad.net/ubuntu/+source/libguestfs/+bug/1722800 > > the libguestfs currently supports ZFS filesystem only partially > i.e. for virt-rescue. > > Q: Would it be possible to bring ZFS support also to other > libguestfs utils, like guestfish and virt-format? > > I would need to have two usecases supported:Thanks for posting here. As you say, ZFS support in libguestfs is currently very limited. Enabling it basically adds the userspace package so it's available in virt-rescue, if you manually use the ‘zfs’/‘zpool’/etc commands.> a) create a new volume with ZFS filesystem / format existing volume > into ZFS filesystemWe could fairly easily make simple things work like creating a filesystem. This is a good beginners patch as it just involves making simple adjustments to this function: https://github.com/libguestfs/libguestfs/blob/master/daemon/mkfs.c#L35> b) manage files from ZFS volume (read, write)I believe that mounting a ZFS volume should just work currently. If not, you might need to make only simple adjustments to the mount API: https://github.com/libguestfs/libguestfs/blob/master/daemon/mount.ml#L24 This should allow you to read and write files. Providing full ZFS volume management is a quite a bit harder. It would involve pulling in some of the zfs APIs and turning them into libguestfs APIs. There is lots of documentation about how to add new APIs here: http://libguestfs.org/guestfs-hacking.1.html#extending-libguestfs I would start by looking at how other APIs have been implemented. Particularly relevant would be the LVM and btrfs APIs, eg: https://github.com/libguestfs/libguestfs/blob/master/daemon/btrfs.c Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Hi Richard, thanks for a quick reply. For now, I will not go into patching the libguestfs by myself since this is out of my scope. But I'm looking forward to see ZFS covered by this awesome library one day :D Regards, Miha ----- Original Message ----- From: "Richard W.M. Jones" <rjones@redhat.com> To: "Miha Pleško" <miha.plesko@xlab.si> Cc: libguestfs@redhat.com Sent: Thursday, October 12, 2017 11:49:11 AM Subject: Re: [Libguestfs] ZFS Support On Thu, Oct 12, 2017 at 09:46:13AM +0200, Miha Pleško wrote:> > Dear libguestfs developers, > > as explained yesterday by Ubuntu guys on my bug report > https://bugs.launchpad.net/ubuntu/+source/libguestfs/+bug/1722800 > > the libguestfs currently supports ZFS filesystem only partially > i.e. for virt-rescue. > > Q: Would it be possible to bring ZFS support also to other > libguestfs utils, like guestfish and virt-format? > > I would need to have two usecases supported:Thanks for posting here. As you say, ZFS support in libguestfs is currently very limited. Enabling it basically adds the userspace package so it's available in virt-rescue, if you manually use the ‘zfs’/‘zpool’/etc commands.> a) create a new volume with ZFS filesystem / format existing volume > into ZFS filesystemWe could fairly easily make simple things work like creating a filesystem. This is a good beginners patch as it just involves making simple adjustments to this function: https://github.com/libguestfs/libguestfs/blob/master/daemon/mkfs.c#L35> b) manage files from ZFS volume (read, write)I believe that mounting a ZFS volume should just work currently. If not, you might need to make only simple adjustments to the mount API: https://github.com/libguestfs/libguestfs/blob/master/daemon/mount.ml#L24 This should allow you to read and write files. Providing full ZFS volume management is a quite a bit harder. It would involve pulling in some of the zfs APIs and turning them into libguestfs APIs. There is lots of documentation about how to add new APIs here: http://libguestfs.org/guestfs-hacking.1.html#extending-libguestfs I would start by looking at how other APIs have been implemented. Particularly relevant would be the LVM and btrfs APIs, eg: https://github.com/libguestfs/libguestfs/blob/master/daemon/btrfs.c Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top