summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-09-02 11:34:07 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-09-02 15:05:59 +0200
commitb433d8409586fb9a16e50ed0262a96dd6490a014 (patch)
treefe1764a7ae2240f2c6cf9eed5afc89b59c6d6ce3 /ogcp
parentd00e437b8d76bc32732643a92f0ea32fbe0b7901 (diff)
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.
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/views.py8
1 files changed, 8 insertions, 0 deletions
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')} "