Commit 222f3e8
feat(prepare): exclude loop and virtual devices from host LVM scanning (#49)
* feat(prepare): exclude loop and virtual devices from host LVM scanning
Set an LVM global_filter in /etc/lvm/lvm.conf in the prepare playbooks so
the host LVM does not scan or activate volume groups backed by LINSTOR/DRBD
volumes — or located inside loop-mounted images. Filters /dev/drbd*,
/dev/dm-*, /dev/zd* and /dev/loop*, mirroring the Talos machine config.
Applied to the ubuntu, rhel and suse prepare playbooks via lineinfile so the
distro's default lvm.conf is preserved.
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
* feat(prepare): make host LVM global_filter configurable and robust
Expose the host LVM global_filter as cozystack_lvm_global_filter so
operators whose own PVs live on device-mapper devices (LVM-on-LUKS,
multipath) can override the default instead of having those PVs filtered
out. The default list is unchanged.
Relax the insertafter anchor to '^\s*devices\s*{' so the setting still
lands inside the devices{} block when lvm.conf uses leading whitespace
or compact bracing; with the stricter '^devices {' a non-match made
lineinfile append global_filter at EOF, where LVM ignores it.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
* docs(prepare): document host LVM global_filter and override variable
Add a 'Required: Host LVM global_filter' section next to the multipath
DRBD blacklist describing the silent-failure trap it prevents, a row for
cozystack_lvm_global_filter in the example-playbook variables table, and
a CHANGELOG note that the filter is overridable from inventory.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
* fix(changelog): collapse duplicate Unreleased section
The Unreleased entries had drifted into two headers — one without an
RST underline (rendering as body text) and a second underlined block
with a Bugfixes subsection. Merge them into a single underlined
Unreleased section with flat bullets matching the released-version
style, so the release workflow's Unreleased-to-version rename targets
one unambiguous section.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
* docs(prepare): note LVM global_filter task replaces existing entries
Clarify that the lineinfile task overwrites any existing global_filter
(commented or active) in lvm.conf, so operators with custom filter rules
must set cozystack_lvm_global_filter to the full desired list rather than
only the entries they want to add.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
* test(prepare): cover host LVM global_filter rendering and lineinfile
Add tests/test-lvm-global-filter.yml asserting the templated default
renders to valid LVM syntax, the lineinfile replaces a commented
global_filter in place inside the devices block, is idempotent, falls
back to the insertafter anchor (including an indented devices header)
when no filter line exists, and honours a cozystack_lvm_global_filter
override. Wire it into the Test workflow as its own job.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
* test(prepare): pin regexp and insertafter across prepare playbooks
Extend the global_filter test with a drift guard that loads the rhel,
suse and ubuntu prepare playbooks and asserts each one's regexp,
insertafter and raw line template match the canonical values exercised
here. Editing the task in one playbook without the others — or without
this test — now fails CI.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
* feat(prepare): verify host LVM global_filter took effect
After writing global_filter, query LVM (lvmconfig devices/global_filter)
and fail the play if the setting is not reported as active — for example
when lvm.conf has no devices {} section and lineinfile appended the line
at EOF, outside every block, where LVM silently ignores it. Turns that
silent no-op into an actionable failure at prep time.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
* test(prepare): verify global_filter effectiveness with lvmconfig
Drive each lvm.conf shape (commented-in-block, no-filter, indented
header, override, and no-devices-block) through the prepare playbooks'
lineinfile, then ask LVM via lvmconfig + LVM_SYSTEM_DIR whether the
filter is effective — asserting it is for in-block cases and is NOT for
the no-devices-block case (the silent failure the post-write check
catches). Install lvm2 in the Test workflow for lvmconfig.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
* docs(prepare): document the global_filter effectiveness check
Note in the README and CHANGELOG that the prepare playbooks verify the
global_filter with lvmconfig after writing it and fail loudly when it did
not take effect (e.g. an lvm.conf with no devices section).
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
* feat(prepare): verify the effective global_filter value, not just success
Compare the list lvmconfig reports for devices/global_filter against the
configured cozystack_lvm_global_filter, not only its exit status. When
lvm.conf holds more than one global_filter line, lineinfile replaces the
last match — which may sit outside devices {} — while a stale in-block
filter keeps winning; lvmconfig then returns 0 with the old value. The
value comparison rejects that. The default list is hoisted to a single
_cozystack_lvm_default_filter fact shared by the write and the check.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
* test(prepare): cover the stale-duplicate global_filter case
Add a scenario where a stale global_filter inside devices {} plus a
second match after it make lineinfile leave the stale value effective;
assert lvmconfig reports a list that does NOT equal the configured one —
which is what the playbooks' value comparison rejects. Mirror the
single-source _cozystack_lvm_default_filter the playbooks now use.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
---------
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Aleksei Sviridkin <f@lex.la>1 parent b32c277 commit 222f3e8
8 files changed
Lines changed: 411 additions & 7 deletions
File tree
- .github/workflows
- examples
- rhel
- suse
- ubuntu
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
187 | 208 | | |
188 | 209 | | |
189 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
104 | 118 | | |
105 | 119 | | |
106 | 120 | | |
| |||
362 | 376 | | |
363 | 377 | | |
364 | 378 | | |
| 379 | + | |
365 | 380 | | |
366 | 381 | | |
367 | 382 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
284 | 335 | | |
285 | 336 | | |
286 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
279 | 330 | | |
280 | 331 | | |
281 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
325 | 376 | | |
326 | 377 | | |
327 | 378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
0 commit comments