Skip to content

Commit

Permalink
Merge pull request #273 from truenas/NAS-129441
Browse files Browse the repository at this point in the history
NAS-129441 / 24.10 / Add force flag for mounting datasets
  • Loading branch information
Qubad786 authored Jun 6, 2024
2 parents e0aeeee + dbba16c commit 3d3fce5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions libzfs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4246,29 +4246,29 @@ cdef class ZFSDataset(ZFSResource):
self.root.write_history('zfs mount', self.name)

IF HAVE_ZFS_ENCRYPTION:
def mount_recursive(self, ignore_errors=False, skip_unloaded_keys=True):
return self._mount_recursive(ignore_errors, skip_unloaded_keys)
def mount_recursive(self, ignore_errors=False, skip_unloaded_keys=True, force_mount=False):
return self._mount_recursive(ignore_errors, skip_unloaded_keys, force_mount)
ELSE:
def mount_recursive(self, ignore_errors=False):
return self._mount_recursive(ignore_errors, False)
def mount_recursive(self, ignore_errors=False, force_mount=False):
return self._mount_recursive(ignore_errors, False, force_mount)

def _mount_recursive(self, ignore_errors, skip_unloaded_keys):
def _mount_recursive(self, ignore_errors, skip_unloaded_keys, force_mount):
if self.type != DatasetType.FILESYSTEM:
return

IF HAVE_ZFS_ENCRYPTION:
if self.encrypted and not self.key_loaded and skip_unloaded_keys:
return

if self.properties['canmount'].value == 'on':
if self.properties['canmount'].value == 'on' or force_mount:
try:
self.mount()
except:
if not ignore_errors:
raise

for i in self.children:
i._mount_recursive(ignore_errors, skip_unloaded_keys)
i._mount_recursive(ignore_errors, skip_unloaded_keys, force_mount)

def umount(self, force=False):
cdef int flags = 0
Expand Down

0 comments on commit 3d3fce5

Please sign in to comment.