views: restrict image restore update and create to disk 1

Keep restore update and create image operations restricted to the
first disk as enabling it for multiple disk is untested and
requires more work.
master
Alejandro Sirgo Rica 2024-09-02 11:34:07 +02:00
parent d00e437b8d
commit b433d84095
1 changed files with 8 additions and 0 deletions

View File

@ -1064,6 +1064,8 @@ def action_image_restore():
part_id = partition['partition']
if part_id == 0: # This is the disk data, not a partition.
continue
if disk_id != 1:
continue
part_code = partition['code']
if PART_TYPE_CODES.get(int(part_code), 'UNKNOWN') == 'CACHE':
has_cache = True
@ -2444,6 +2446,9 @@ def action_image_create():
if part_type in invalid_part_types:
continue
if part.get('disk') != 1:
continue
form.os.choices.append(
(f"{part.get('disk')} {part.get('partition')} {part.get('code')}",
f"Disk {part.get('disk')} | Partition {part.get('partition')} "
@ -2567,6 +2572,9 @@ def action_image_update():
if part_type in invalid_part_types:
continue
if part.get('disk') != 1:
continue
partition_value = f"{part.get('disk')} {part.get('partition')} {part.get('code')}"
partition_text = f"Disk {part.get('disk')} | Partition {part.get('partition')} "
f"| {PART_TYPE_CODES.get(part.get('code'), 'UNKNOWN')} "