Increased disk delays by 100% (for unsuccessful operations), successful should still be quick. (#730)

Co-authored-by: Anton Hvornum <anton.feeds@gmail.com>
This commit is contained in:
Anton Hvornum 2021-11-18 13:07:28 +00:00 committed by GitHub
parent 7d991ecb9f
commit 776823adfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -33,7 +33,7 @@ class Filesystem:
return True
def partuuid_to_index(self, uuid):
for i in range(10):
for i in range(storage['DISK_RETRY_ATTEMPTS']):
self.partprobe()
output = json.loads(SysCommand(f"lsblk --json -o+PARTUUID {self.blockdevice.device}").decode('UTF-8'))
@ -42,7 +42,7 @@ class Filesystem:
if (partuuid := partition.get('partuuid', None)) and partuuid.lower() == uuid:
return index
time.sleep(1)
time.sleep(storage['DISK_TIMEOUTS'])
raise DiskError(f"Failed to convert PARTUUID {uuid} to a partition index number on blockdevice {self.blockdevice.device}")

View File

@ -147,7 +147,7 @@ class Partition:
This is more reliable than relying on /dev/disk/by-partuuid as
it doesn't seam to be able to detect md raid partitions.
"""
for i in range(10):
for i in range(storage['DISK_RETRY_ATTEMPTS']):
self.partprobe()
partuuid_struct = SysCommand(f'lsblk -J -o+PARTUUID {self.path}')
@ -155,7 +155,7 @@ class Partition:
if partition_information := next(iter(json.loads(partuuid_struct.decode('UTF-8'))['blockdevices']), None):
return partition_information.get('partuuid', None)
time.sleep(1)
time.sleep(storage['DISK_TIMEOUTS'])
raise DiskError(f"Could not get PARTUUID for {self.path} using 'lsblk -J -o+PARTUUID {self.path}'")

View File

@ -19,5 +19,7 @@ storage = {
'LOG_PATH': '/var/log/archinstall',
'LOG_FILE': 'install.log',
'MOUNT_POINT': '/mnt/archinstall',
'ENC_IDENTIFIER': 'ainst'
'ENC_IDENTIFIER': 'ainst',
'DISK_TIMEOUTS' : 1, # seconds
'DISK_RETRY_ATTEMPTS' : 20, # RETRY_ATTEMPTS * DISK_TIMEOUTS is used in disk operations
}