views: report clients without cache in fetch and restore

Report clients without cache partition inthe decks of the target
clients with enough cache to fit the target image.
master
Alejandro Sirgo Rica 2024-09-26 12:06:36 +02:00
parent 39371747db
commit 6fecb9d34b
1 changed files with 6 additions and 1 deletions

View File

@ -967,12 +967,17 @@ def image_fits_in_cache(server, clients_info, image):
continue
free_cache = client_info['free_cache']
used_cache = client_info['used_cache']
if used_cache == 0 and free_cache == 0:
err_report += f'{ip} has no cache partition<br>'
continue
if free_cache < image_size:
missing_cache = image_size - free_cache
err_report += f'{ip} requires {(missing_cache / (1024 ** 3)):.3f} more free GiB<br>'
if err_report:
flash(f'No space left on cache:<br>{err_report}', category='error')
flash(f'{err_report}', category='error')
return False
return True