File tree Expand file tree Collapse file tree
python/understack-workflows/understack_workflows/main
workflows/argo-events/workflowtemplates Expand file tree Collapse file tree Original file line number Diff line number Diff 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+
8492def 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 ]
Original file line number Diff line number Diff 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 :
You can’t perform that action at this time.
0 commit comments