Skip to content

Commit 7bd0b77

Browse files
committed
[bm_sno] Allow SNO deploy for LVMS (leave free space)
Signed-off-by: Bohdan Dobrelia <bdobreli@redhat.com>
1 parent 4587a45 commit 7bd0b77

5 files changed

Lines changed: 100 additions & 1 deletion

File tree

docs/dictionary/en-custom.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ rnkhwaejdughvnuzsdz
545545
ro
546546
rolename
547547
rootdevicehints
548+
rootfs
548549
rpms
549550
rpmss
550551
rsa
@@ -627,6 +628,7 @@ undercloud
627628
unicast
628629
unittest
629630
unmanaged
631+
unallocated
630632
uoyt
631633
uri
632634
usermod

roles/bm_sno/README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ provision IP via `/etc/hosts` entries managed by the role.
6262
| `cifmw_bm_agent_core_password` | str || Set a `core` user password post-install via MachineConfig |
6363
| `cifmw_bm_agent_live_debug` | bool | `false` | Patch the agent ISO with password, autologin, and systemd debug shell on `tty6` for discovery-phase console access (requires `cifmw_bm_agent_core_password`) |
6464
| `cifmw_bm_agent_disabled_ifaces` | list | `[]` | Extra NIC names to disable IPv4/IPv6 on during agent-based install. Prevents overlapping-subnet validation failures when multiple NICs share a native VLAN (e.g. `[eno2]`). The interfaces stay link-up but get no IP address; post-install NNCP configures them. |
65+
| `cifmw_bm_agent_lvms_partition` | dict | `{}` | When set, creates an Ignition partition at install time to cap CoreOS rootfs growth and leave unallocated space for the LVMS StorageClass. Keys: `device` (required, e.g. `/dev/nvme0n1`), `rootfs_mib` (default `150000`), `size_mib` (default `0` = rest of disk), `label` (default `lvmstorage`). See [LVMS partition](#lvms-partition). |
6566

6667
## Secrets management
6768

@@ -119,7 +120,8 @@ If the binary already exists in the working directory it is reused.
119120
2. Ensure `GenericUsbBoot` is enabled in BIOS (auto-enable with power cycle if allowed)
120121
3. Power off the host
121122
4. Generate SSH keys, template `install-config.yaml` and `agent-config.yaml`
122-
5. Acquire `openshift-install` binary (see above) and run `openshift-install agent create image` to build the agent ISO
123+
5. Optionally generate an LVMS partition MachineConfig into `openshift/` manifests
124+
6. Acquire `openshift-install` binary (see above) and run `openshift-install agent create image` to build the agent ISO
123125
6. Optionally patch the ISO for discovery-phase console access
124126
7. Serve the ISO via a root podman httpd container (rootless podman cannot use privileged ports)
125127
8. Eject any existing VirtualMedia, then insert the agent ISO
@@ -267,6 +269,46 @@ cifmw_bm_agent_core_password: changeme
267269
cifmw_bm_agent_live_debug: true
268270
```
269271

272+
## LVMS partition
273+
274+
By default CoreOS expands its rootfs partition to fill the entire disk
275+
at first boot. To reserve space for the LVMS (Logical Volume Manager
276+
Storage) StorageClass, set `cifmw_bm_agent_lvms_partition` with at
277+
least the `device` key. The role injects a MachineConfig manifest into
278+
the agent ISO that creates a labeled partition via Ignition — before
279+
`growfs` runs — so CoreOS rootfs stops at `rootfs_mib` and the
280+
remainder is available for LVMS.
281+
282+
```yaml
283+
cifmw_bm_agent_lvms_partition:
284+
device: /dev/disk/by-path/pci-0000:65:00.0-scsi-0:3:111:0
285+
rootfs_mib: 150000 # ~150 GB for CoreOS (minimum 25000)
286+
size_mib: 0 # 0 = rest of disk
287+
label: lvmstorage # partition label
288+
```
289+
290+
After OCP is installed, create an `LVMCluster` CR that targets the
291+
partition by label:
292+
293+
```yaml
294+
apiVersion: lvm.topolvm.io/v1alpha1
295+
kind: LVMCluster
296+
metadata:
297+
name: lvmcluster
298+
namespace: openshift-storage
299+
spec:
300+
storage:
301+
deviceClasses:
302+
- name: lvmstorage
303+
deviceSelector:
304+
paths:
305+
- /dev/disk/by-partlabel/lvmstorage
306+
thinPoolConfig:
307+
name: thin-pool
308+
overprovisionRatio: 10
309+
sizePercent: 90
310+
```
311+
270312
## References
271313

272314
* [ci-framework reproducer documentation](https://ci-framework.readthedocs.io/en/latest/roles/reproducer.html)

roles/bm_sno/defaults/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,14 @@ cifmw_bm_agent_live_debug: false
77
cifmw_bm_agent_vmedia_uefi_path: ""
88
cifmw_bm_agent_enable_usb_boot: true
99
cifmw_bm_agent_disabled_ifaces: []
10+
11+
# LVMS partition: restrict CoreOS rootfs growth and leave
12+
# unallocated space for the LVMS StorageClass.
13+
# Set cifmw_bm_agent_lvms_partition to enable.
14+
# Example:
15+
# cifmw_bm_agent_lvms_partition:
16+
# device: /dev/disk/by-path/pci-0000:65:00.0-scsi-0:3:111:0
17+
# rootfs_mib: 150000 # rootfs capped at ~150 GB
18+
# size_mib: 0 # 0 = rest of disk
19+
# label: lvmstorage
20+
cifmw_bm_agent_lvms_partition: {}

roles/bm_sno/tasks/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,32 @@
219219
regexp: '^pullSecret:'
220220
line: "pullSecret: '<REDACTED>'"
221221

222+
- name: Create LVMS partition MachineConfig manifest
223+
when: cifmw_bm_agent_lvms_partition | default({}) | length > 0
224+
block:
225+
- name: Validate LVMS partition device is set
226+
ansible.builtin.assert:
227+
that:
228+
- cifmw_bm_agent_lvms_partition.device is defined
229+
- cifmw_bm_agent_lvms_partition.device | length > 0
230+
fail_msg: >-
231+
cifmw_bm_agent_lvms_partition.device must be set
232+
(e.g. /dev/nvme0n1, /dev/disk/by-path/...).
233+
234+
- name: Create openshift manifests directory
235+
ansible.builtin.file:
236+
path: "{{ _work_dir }}/openshift"
237+
state: directory
238+
mode: "0755"
239+
240+
- name: Template LVMS partition MachineConfig
241+
vars:
242+
_lvms: "{{ cifmw_bm_agent_lvms_partition }}"
243+
ansible.builtin.template:
244+
src: lvms_partition_machineconfig.yaml.j2
245+
dest: "{{ _work_dir }}/openshift/98-lvms-partition.yaml"
246+
mode: "0644"
247+
222248
- name: Ensure nmstatectl is available for agent-config networkConfig validation
223249
become: true
224250
ansible.builtin.package:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
apiVersion: machineconfiguration.openshift.io/v1
3+
kind: MachineConfig
4+
metadata:
5+
labels:
6+
machineconfiguration.openshift.io/role: master
7+
name: 98-lvms-partition
8+
spec:
9+
config:
10+
ignition:
11+
version: 3.4.0
12+
storage:
13+
disks:
14+
- device: {{ _lvms.device }}
15+
partitions:
16+
- label: {{ _lvms.label | default('lvmstorage') }}
17+
startMiB: {{ _lvms.rootfs_mib | default(150000) }}
18+
sizeMiB: {{ _lvms.size_mib | default(0) }}

0 commit comments

Comments
 (0)