Skip to content

Commit ab4a5ae

Browse files
authored
Support software raid root disks in stackhpc images (#785)
* support raid root disks in stackhpc-built images * clarify image requirements * bump CI image * fixup grub for RL8 * fix linter issues * fix raid kernel commandline configuration for RL8 [no ci] * bump CI image * fix handler ansible-lint errors * bump CI image
1 parent 4548b9b commit ab4a5ae

File tree

9 files changed

+59
-3
lines changed

9 files changed

+59
-3
lines changed

ansible/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,5 @@ roles/*
9898
!roles/eessi/**
9999
!roles/topology/
100100
!roles/topology/**
101+
!roles/raid/
102+
!roles/raid/**

ansible/extras.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
---
1+
- hosts: raid
2+
become: true
3+
tags: raid
4+
gather_facts: true
5+
tasks:
6+
- ansible.builtin.include_role:
7+
name: raid
8+
29
- hosts: k3s_server:!builder
310
become: true
411
tags: k3s

ansible/roles/raid/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# raid
2+
3+
Configure an image to support software raid (via [mdadm](https://github.com/md-raid-utilities/mdadm)).
4+
5+
RockyLinux genericcloud images already have the necessary `mdraid` dracut
6+
module installed, as well as kernel modules for `raid0`, `raikd1`, `raid10` and
7+
`raid456` [^1]. This covers all raid modes [supported by Ironic](https://docs.openstack.org/ironic/latest/admin/raid.html#software-raid)
8+
hence this role does not support extending this.
9+
10+
This role changes the command line for the current kernel. It does not reboot
11+
the instance so generally is only useful during image builds.
12+
13+
Note that the `rootfs_uuid` image property described in the [Ironic raid documentation](https://docs.openstack.org/ironic/latest/admin/raid.html#image-requirements)
14+
is not required; the root partition is the first (non-boot) partition and this
15+
is sufficent for Ironic to find the root file system.
16+
17+
[^1]: As shown by `lsinitrd /boot/initramfs-$(uname -r).img | grep raid`
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- name: Update GRUB configuration file
2+
ansible.builtin.command: "grub2-mkconfig -o /boot/grub2/grub.cfg {{ '--update-bls-cmdline' if ansible_distribution_major_version == '9' else '' }}"
3+
changed_when: true

ansible/roles/raid/tasks/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- name: Enable autoassembly of mdraid devices
2+
# adds rd.auto=1 - see `man dracut.cmdline`
3+
ansible.builtin.lineinfile:
4+
path: /etc/default/grub
5+
regexp: >
6+
^{{ grub_cmdline_var[ansible_distribution_major_version] }}="((?:(?!rd.auto=1).)*?)"$
7+
line: >
8+
{{ grub_cmdline_var[ansible_distribution_major_version] }}="\1 rd.auto=1"
9+
backup: true
10+
backrefs: true
11+
register: update_grub
12+
notify:
13+
- Update GRUB configuration file
14+
vars:
15+
grub_cmdline_var:
16+
'8': GRUB_CMDLINE_LINUX
17+
'9': GRUB_CMDLINE_LINUX_DEFAULT

environments/.stackhpc/inventory/extra_groups

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ cluster
5050

5151
[compute_init:children]
5252
compute
53+
54+
[raid:children]
55+
# Configure fatimage for raid
56+
builder
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"cluster_image": {
3-
"RL8": "openhpc-RL8-250924-1502-e9afbfe5",
4-
"RL9": "openhpc-RL9-250924-1536-e9afbfe5"
3+
"RL8": "openhpc-RL8-250925-1639-62d67ae3",
4+
"RL9": "openhpc-RL9-250925-1639-62d67ae3"
55
}
66
}

environments/common/inventory/groups

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,6 @@ extra_packages
217217
# separately from the appliance. e.g
218218
# pulp_host ansible_host=<VM-ip-address>
219219
# Note the host name can't conflict with group names i.e can't be called `pulp` or `pulp_server`
220+
221+
[raid]
222+
# Add `builder` to configure image for software raid

environments/site/inventory/groups

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,6 @@ compute
169169
# separately from the appliance. e.g
170170
# pulp_host ansible_host=<VM-ip-address>
171171
# Note inventory host name cannot conflict with group names i.e can't be called `pulp` or `pulp_server`.
172+
173+
[raid]
174+
# Add `builder` to configure image for software raid

0 commit comments

Comments
 (0)