mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 14:11:07 +02:00
disk_util: retry loopback mounts if they fail
This fails frequently but should succeed if retried. This should reduce failed builds.
This commit is contained in:
parent
00d77d199a
commit
15745d520e
@ -598,9 +598,22 @@ def Mount(options):
|
|||||||
mount_opts.append('subvol=%s' % mount['fs_subvolume'])
|
mount_opts.append('subvol=%s' % mount['fs_subvolume'])
|
||||||
|
|
||||||
Sudo(['mkdir', '-p', full_path])
|
Sudo(['mkdir', '-p', full_path])
|
||||||
Sudo(['mount', '-t', mount.get('fs_type', 'auto'),
|
# This tends to fail, retry if it does
|
||||||
'-o', ','.join(mount_opts),
|
err = None
|
||||||
options.disk_image, full_path])
|
for i in range(0,5):
|
||||||
|
try:
|
||||||
|
Sudo(['mount', '-t', mount.get('fs_type', 'auto'),
|
||||||
|
'-o', ','.join(mount_opts),
|
||||||
|
options.disk_image, full_path])
|
||||||
|
err = None
|
||||||
|
break
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print("Error mounting %s, attempt %d" % (full_path, i))
|
||||||
|
err = e
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
if err is not None:
|
||||||
|
raise err
|
||||||
|
|
||||||
for src, dst in mount.get('binds', {}).iteritems():
|
for src, dst in mount.get('binds', {}).iteritems():
|
||||||
# src may be relative or absolute, os.path.join handles this.
|
# src may be relative or absolute, os.path.join handles this.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user