Skip to content

Commit b232b67

Browse files
authored
Merge pull request #1676 from rackerlabs/PUC-1494
fix: raid_level defined by disk_count.
2 parents 71394ac + ce52a55 commit b232b67

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

python/understack-workflows/understack_workflows/main/get_raid_devices.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,24 @@ def parse_controller_details(client: Sushy) -> dict:
8181
return result
8282

8383

84+
def get_raid_type(disk_count: int) -> int:
85+
if disk_count < 2:
86+
return 0
87+
if disk_count > 2:
88+
return 5
89+
return 1
90+
91+
8492
def build_raid_config(raid_config: dict):
8593
"""Return a raid config supported by ironic for cleanup tasks."""
94+
raid_level = get_raid_type(len(raid_config["physical_disks"]))
8695
result = {
8796
"logical_disks": [
8897
{
8998
"controller": raid_config["controller"],
9099
"is_root_volume": True,
91100
"physical_disks": raid_config["physical_disks"],
92-
"raid_level": "1",
101+
"raid_level": str(raid_level),
93102
"size_gb": "MAX",
94103
}
95104
]

workflows/argo-events/workflowtemplates/enroll-server.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ spec:
185185
image: ghcr.io/rackerlabs/understack/openstack-client:2025.2
186186
command: [sh]
187187
source: |
188-
echo "setting RAID1 config for node: {{inputs.parameters.device_id}}"
189-
# create the raid1-config.json file. I find this easier to read
188+
echo "setting RAID config for node: {{inputs.parameters.device_id}}"
189+
# create the raid-config.json file. I find this easier to read
190190
# than passing a big json string on command line
191-
cat <<'EOF' >> raid1-config.json
191+
cat <<'EOF' >> raid-config.json
192192
{{inputs.parameters.raid_config}}
193193
EOF
194194
# create the initial clean steps which will create a raid config
@@ -205,7 +205,7 @@ spec:
205205
]
206206
EOF
207207
# apply the target raid config to the node
208-
openstack baremetal node set {{inputs.parameters.device_id}} --target-raid-config raid1-config.json
208+
openstack baremetal node set {{inputs.parameters.device_id}} --target-raid-config raid-config.json
209209
# create the raid config
210210
openstack baremetal node clean --wait 0 --clean-steps raid-clean-steps.json --disable-ramdisk {{inputs.parameters.device_id}}
211211
env:

0 commit comments

Comments
 (0)