[umount] Export zpools after unmounting
This commit is contained in:
parent
cf20d6495b
commit
cca38695ed
@ -49,6 +49,26 @@ def list_mounts(root_mount_point):
|
|||||||
return lst
|
return lst
|
||||||
|
|
||||||
|
|
||||||
|
def export_zpools(root_mount_point):
|
||||||
|
""" Exports the zpools if defined in global storage
|
||||||
|
|
||||||
|
:param root_mount_point: The absolute path to the root of the install
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
zfs_pool_list = libcalamares.globalstorage.value("zfsPoolInfo")
|
||||||
|
zfs_pool_list.sort(reverse=True, key=lambda x: x["poolName"])
|
||||||
|
if zfs_pool_list:
|
||||||
|
for zfs_pool in zfs_pool_list:
|
||||||
|
import_result = subprocess.run(['zpool', 'export', root_mount_point, zfs_pool["poolName"]])
|
||||||
|
if import_result.returncode != 0:
|
||||||
|
libcalamares.utils.warning("Failed to export zpool")
|
||||||
|
except Exception as e:
|
||||||
|
# If this fails it shouldn't cause the installation to fail
|
||||||
|
libcalamares.utils.warning("Received exception while exporting zpools: " + format(e))
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
""" Unmounts given mountpoints in decreasing order.
|
""" Unmounts given mountpoints in decreasing order.
|
||||||
|
|
||||||
@ -94,6 +114,8 @@ def run():
|
|||||||
# in the exception object.
|
# in the exception object.
|
||||||
subprocess.check_output(["umount", "-lv", mount_point], stderr=subprocess.STDOUT)
|
subprocess.check_output(["umount", "-lv", mount_point], stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
export_zpools(root_mount_point)
|
||||||
|
|
||||||
os.rmdir(root_mount_point)
|
os.rmdir(root_mount_point)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user