[mount] Improve error handling for zfs
This commit is contained in:
parent
858e271c8a
commit
85a2160098
@ -136,18 +136,22 @@ def mount_partition(root_mount_point, partition, partitions):
|
|||||||
zfs = libcalamares.globalstorage.value("zfs")
|
zfs = libcalamares.globalstorage.value("zfs")
|
||||||
|
|
||||||
if not zfs:
|
if not zfs:
|
||||||
libcalamares.utils.warning("Failed to locate zfs dataset list")
|
libcalamares.utils.error("Failed to locate zfs dataset list")
|
||||||
|
|
||||||
# Set the canmount property for each dataset. This will effectively mount the dataset
|
# Set the canmount property for each dataset. This will effectively mount the dataset
|
||||||
for dataset in zfs:
|
for dataset in zfs:
|
||||||
if dataset['canmount'] == 'noauto' or dataset['canmount'] == 'on':
|
try:
|
||||||
subprocess.check_call(['zfs', 'set', 'canmount=' + dataset['canmount'],
|
if dataset['canmount'] == 'noauto' or dataset['canmount'] == 'on':
|
||||||
dataset['zpool'] + '/' + dataset['dsName']])
|
subprocess.check_call(['zfs', 'set', 'canmount=' + dataset['canmount'],
|
||||||
|
dataset['zpool'] + '/' + dataset['dsName']])
|
||||||
|
|
||||||
# It is common for the / mountpoint to be set to noauto since it is mounted by the initrd
|
# It is common for the / mountpoint to be set to noauto since it is mounted by the initrd
|
||||||
# If this is the case we need to manually mount it here
|
# If this is the case we need to manually mount it here
|
||||||
if dataset['mountpoint'] == '/' and dataset['canmount'] == 'noauto':
|
if dataset['mountpoint'] == '/' and dataset['canmount'] == 'noauto':
|
||||||
subprocess.check_call(['zfs', 'mount', dataset['zpool'] + '/' + dataset['dsName']])
|
subprocess.check_call(['zfs', 'mount', dataset['zpool'] + '/' + dataset['dsName']])
|
||||||
|
except KeyError:
|
||||||
|
# This should be impossible
|
||||||
|
libcalamares.utils.error("Internal error handling zfs dataset")
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
Loading…
Reference in New Issue
Block a user