diff --git a/src/simplezfs/pe_helper.py b/src/simplezfs/pe_helper.py index c51e83a..871993d 100644 --- a/src/simplezfs/pe_helper.py +++ b/src/simplezfs/pe_helper.py @@ -34,6 +34,15 @@ class PEHelperBase: ''' raise NotImplementedError(f'{self} has not implemented this function') + def zfs_umount(self, fileset: str) -> None: + ''' + Tries to umount ``fileset``. It does **not** check if the fileset is mounted. + + :raises ValidationError: If parameters do not validate. + :raises PEHelperException: If errors are encountered when running the helper. + ''' + raise NotImplementedError(f'{self} has not implemented this function') + def zfs_set_mountpoint(self, fileset: str, mountpoint: str) -> None: ''' Sets the ``mountpoint`` property of the given ``fileset``. @@ -169,6 +178,14 @@ class SudoPEHelper(PEHelperBase): self._execute_cmd(['zfs', 'mount', fileset]) + def zfs_umount(self, fileset: str) -> None: + if '/' in fileset: + validate_dataset_path(fileset) + else: + validate_pool_name(fileset) + + self._execute_cmd(['zfs', 'umount', fileset]) + def zfs_set_mountpoint(self, fileset: str, mountpoint: str) -> None: if '/' in fileset: validate_dataset_path(fileset)