filesystem: add create_zfs helper

This commit is contained in:
Dan Bungert 2023-08-24 15:11:47 -06:00
parent ee589e34f1
commit 65bd6752fa
1 changed files with 12 additions and 0 deletions

View File

@ -1137,6 +1137,18 @@ class ZPool:
return self.mountpoint return self.mountpoint
return None return None
def create_zfs(self, volume, canmount="on", mountpoint=None):
properties = {}
if canmount is not None:
properties["canmount"] = canmount
if mountpoint is not None:
properties["mountpoint"] = mountpoint
if len(properties) < 1:
properties = None
zfs = ZFS(m=self._m, pool=self, volume=volume, properties=properties)
self._m._actions.append(zfs)
return zfs
@fsobj("zfs") @fsobj("zfs")
class ZFS: class ZFS: