Retry unmounting
This commit is contained in:
parent
f72e786efa
commit
a79006dc41
@ -102,26 +102,30 @@ class OverlayFSMount:
|
|||||||
self._mounted = True
|
self._mounted = True
|
||||||
return self.mount_path
|
return self.mount_path
|
||||||
|
|
||||||
def unmount(self):
|
def unmount(self) -> bool:
|
||||||
if self._mounted:
|
if self._mounted:
|
||||||
print("Unmounting...")
|
print("Unmounting...")
|
||||||
|
|
||||||
# Remove the mount
|
# Remove the mount
|
||||||
if LMMConfig.use_fuse:
|
if LMMConfig.use_fuse:
|
||||||
run_cmd(
|
returncode = run_cmd(
|
||||||
[
|
[
|
||||||
LMMConfig.fusermount_command,
|
LMMConfig.fusermount_command,
|
||||||
"-u",
|
"-u",
|
||||||
str(self.mount_path),
|
str(self.mount_path),
|
||||||
]
|
]
|
||||||
)
|
) == 0
|
||||||
else:
|
else:
|
||||||
run_sudo_cmd(
|
returncode = run_sudo_cmd(
|
||||||
[
|
[
|
||||||
"umount",
|
"umount",
|
||||||
str(self.mount_path),
|
str(self.mount_path),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if returncode != 0:
|
||||||
|
print("Unmounting failed")
|
||||||
|
return False
|
||||||
|
|
||||||
# Remove the temporary workdir
|
# Remove the temporary workdir
|
||||||
if self.workdir is not None:
|
if self.workdir is not None:
|
||||||
@ -132,6 +136,7 @@ class OverlayFSMount:
|
|||||||
print(f"Failed to clean temporary directory {self.workdir.name}")
|
print(f"Failed to clean temporary directory {self.workdir.name}")
|
||||||
|
|
||||||
self._mounted = False
|
self._mounted = False
|
||||||
|
return True
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.unmount()
|
self.unmount()
|
||||||
|
Loading…
Reference in New Issue
Block a user