From b433d8409586fb9a16e50ed0262a96dd6490a014 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Mon, 2 Sep 2024 11:34:07 +0200 Subject: 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. --- ogcp/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ogcp') diff --git a/ogcp/views.py b/ogcp/views.py index 579a43f..397831e 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -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')} " -- cgit v1.2.3-18-g5258