Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ZFS zvols #36

Closed
HubbeKing opened this issue Feb 5, 2020 · 3 comments
Closed

Support for ZFS zvols #36

HubbeKing opened this issue Feb 5, 2020 · 3 comments

Comments

@HubbeKing
Copy link

It would be nice to support ZFS volumes in addition to LVM logical volumes.

This would allow for using ZFS on Linux as a storage provider for kubernetes, through the kubernetes targetd provisioner https://github.com/kubernetes-incubator/external-storage/tree/master/iscsi/targetd
FreeNAS has its own APIs that another kubernetes provisioner uses for a zvol+iscsi storage provisioner, but nothing similar exists for ZFS on Linux as of yet.

As ZFS volumes are still block devices, it should be possible to interact with them just like one interacts with LVM logical volumes as far as iSCSI is concerned.

Interacting with a ZFS storage pool from python could be done with the native zfs-utils shell commands (using the -H flag for scripting mode for the commands that support it) or through a python ZFS library like pyzfs https://github.com/ClusterHQ/pyzfs or pyzfscmds https://github.com/johnramsden/pyzfscmds

@tasleson
Copy link
Member

tasleson commented Feb 6, 2020

This is an interesting request. I can see the benefit for folks that utilize ZFS. However, for this to be integrated with targetd I believe the following would need to be considered.

  1. Targetd should be able to be installed and run without any additional install or runtime ZFS dependencies for the case when ZFS support is not utilized. Could leverage config file or dynamically investigate at runtime.
  2. Any interaction with ZFS should be done with something like pyzfscmds instead of pyzfs. The reason being that it's typically accepted that running something in the same memory space needs to have a compatible license. Thus to mitigate any license incompatibility, if the interaction occurs over a command line via fork & exec the license issue becomes moot.

With all that being satisfied, I don't believe there would be any objections to adding this functionality to targetd, PR(s) welcomed.

@HubbeKing
Copy link
Author

A good way to handle the first matter would be to simply have two options in the config file: the existing block_pools, which would always refer to LVM volumes, and a new option, zfs_datasets - referring to ZFS datasets where one could create ZFS volumes.
Then, if zfs_volume_datasets doesn't contain anything, targetd can just operate as it already does, using existing LVM defaults.

That does raise the question of what to do if both block_pools and zfs_datasets are set, though.

If one uses python's subprocess library one can interface with zfs-utils over command line, so that also deals with the second issue - and since it's in the standard library that adds no install or runtime dependencies, you'd simply have ZFS on Linux as an optional dependency for running in ZFS "mode", so to speak.

triluch pushed a commit to triluch/targetd that referenced this issue Jun 20, 2020
Refers to open-iscsi#36
This adds support for using ZFS datasets as backend pools in targetd.
To be compatible with current setups it adds new zfs_block_pools to
config file. It allows to use ZFS alongside LVM, as well as any of them
separately.

It is only dependant on 'zfs' command and python standard library. Also
works without it when ZFS pools are not set.

Added separate Dockerfile with zfs package to also support that kind of
deployment.

Volume management commands were moved to different modules in backends
directory, block.py now only contains iscsi code and dispatches volume
management commands to proper module.
triluch added a commit to triluch/targetd that referenced this issue Jun 20, 2020
Refers to open-iscsi#36
This adds support for using ZFS datasets as backend pools in targetd.
To be compatible with current setups it adds new zfs_block_pools to
config file. It allows to use ZFS alongside LVM, as well as any of them
separately.

It is only dependant on 'zfs' command and python standard library. Also
works without it when ZFS pools are not set.

Added separate Dockerfile with zfs package to also support that kind of
deployment.

Volume management commands were moved to different modules in backends
directory, block.py now only contains iscsi code and dispatches volume
management commands to proper module.

Copy method remains to be implemented, although should not be hard
using ZFS snapshots.
tasleson pushed a commit to tasleson/targetd that referenced this issue Jun 25, 2020
Refers to open-iscsi#36
This adds support for using ZFS datasets as backend pools in targetd.
To be compatible with current setups it adds new zfs_block_pools to
config file. It allows to use ZFS alongside LVM, as well as any of them
separately.

It is only dependant on 'zfs' command and python standard library. Also
works without it when ZFS pools are not set.

Added separate Dockerfile with zfs package to also support that kind of
deployment.

Volume management commands were moved to different modules in backends
directory, block.py now only contains iscsi code and dispatches volume
management commands to proper module.

Copy method remains to be implemented, although should not be hard
using ZFS snapshots.
triluch added a commit to triluch/targetd that referenced this issue Jun 25, 2020
Refers to open-iscsi#36
This adds support for using ZFS datasets as backend pools in targetd.
To be compatible with current setups it adds new zfs_block_pools to
config file. It allows to use ZFS alongside LVM, as well as any of them
separately.

It is only dependant on 'zfs' command and python standard library. Also
works without it when ZFS pools are not set.

Added separate Dockerfile with zfs package to also support that kind of
deployment.

Volume management commands were moved to different modules in backends
directory, block.py now only contains iscsi code and dispatches volume
management commands to proper module.

Copy method remains to be implemented, although should not be hard
using ZFS snapshots.
@tasleson
Copy link
Member

Resolved with #42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants