Skip to content

Commit

Permalink
Retry umounting in case of device busy
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Reis <[email protected]>
  • Loading branch information
benjamreis committed Feb 1, 2024
1 parent 09e97e0 commit c936e5b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,16 @@ def setup_formatted_and_mounted_disk(host, sr_disk, fs_type, mountpoint):
def teardown_formatted_and_mounted_disk(host, mountpoint):
logging.info(f"<< Restore fstab and unmount {mountpoint} on host {host}")
host.ssh(['cp', '-f', '/etc/fstab.orig', '/etc/fstab'])
host.ssh(['umount', mountpoint])
for i in range(5):
try:
host.ssh(['umount', mountpoint])
break
except Exception as e:
if i < 5:
logging.warning(f"umounting {mountpoint} failed with: {e}, retrying...")
time.sleep(5)
continue
raise e
host.ssh(['rmdir', mountpoint])

def exec_nofail(func):
Expand Down

0 comments on commit c936e5b

Please sign in to comment.