Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,24 @@ def parse_controller_details(client: Sushy) -> dict:
return result


def get_raid_type(disk_count: int) -> int:
if disk_count < 2:
return 0
if disk_count > 2:
return 5
return 1


def build_raid_config(raid_config: dict):
"""Return a raid config supported by ironic for cleanup tasks."""
raid_level = get_raid_type(len(raid_config["physical_disks"]))
result = {
"logical_disks": [
{
"controller": raid_config["controller"],
"is_root_volume": True,
"physical_disks": raid_config["physical_disks"],
"raid_level": "1",
"raid_level": str(raid_level),
"size_gb": "MAX",
}
]
Expand Down
8 changes: 4 additions & 4 deletions workflows/argo-events/workflowtemplates/enroll-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ spec:
image: ghcr.io/rackerlabs/understack/openstack-client:2025.2
command: [sh]
source: |
echo "setting RAID1 config for node: {{inputs.parameters.device_id}}"
# create the raid1-config.json file. I find this easier to read
echo "setting RAID config for node: {{inputs.parameters.device_id}}"
# create the raid-config.json file. I find this easier to read
# than passing a big json string on command line
cat <<'EOF' >> raid1-config.json
cat <<'EOF' >> raid-config.json
{{inputs.parameters.raid_config}}
EOF
# create the initial clean steps which will create a raid config
Expand All @@ -205,7 +205,7 @@ spec:
]
EOF
# apply the target raid config to the node
openstack baremetal node set {{inputs.parameters.device_id}} --target-raid-config raid1-config.json
openstack baremetal node set {{inputs.parameters.device_id}} --target-raid-config raid-config.json
# create the raid config
openstack baremetal node clean --wait 0 --clean-steps raid-clean-steps.json --disable-ramdisk {{inputs.parameters.device_id}}
env:
Expand Down
Loading