Skip to content

add device-uuid validation to protect against swapped disks#500

Open
IvanOgurchenok wants to merge 1 commit into
astef-prototypefrom
astef-prototype-check-device-uuid
Open

add device-uuid validation to protect against swapped disks#500
IvanOgurchenok wants to merge 1 commit into
astef-prototypefrom
astef-prototype-check-device-uuid

Conversation

@IvanOgurchenok

Copy link
Copy Markdown
Contributor

Description

Add device-uuid and node-id validation before drbdadm up to detect swapped disks.

  • Store device-uuid from DRBD metadata in RVR status
  • Validate it on every reconcile (when device is down)
  • Report mismatch errors in status.drbd.errors

No impact on critical components. No restarts required.

Why do we need it, and what problem does it solve?

Protects against accidentally attaching wrong disk after node reboot or disk replacement.

Without this: DRBD could start with wrong data → data corruption or split-brain.
With this: Agent refuses to bring up resource and reports clear error.

What is the expected result?

Normal: RVR gets status.drbd.actual.deviceUUID field, resource works as before.

Disk swapped: Resource stays down, RVR shows error:
status:
drbd:
errors:
deviceUUIDMismatchError:
expected: "0xABCD..."
actual: "0x1234..."

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

@IvanOgurchenok IvanOgurchenok self-assigned this Jan 13, 2026
- Add DeviceUUID field to RVR status to store DRBD metadata identifier
- Validate device-uuid and node-id before drbdadm up (only when device is down)
- Add DeviceUUIDMismatchError and NodeIDMismatchError for disk swap detection
- Handle node-id=-1 for freshly created metadata (before first up)
- Remove --force flag from dump-md (now called only when device is down)
- Add parseMetadata function with regex parsing and unit tests

Signed-off-by: Ivan Ogurchenok <ivan.ogurchenok@flant.com>
@IvanOgurchenok IvanOgurchenok force-pushed the astef-prototype-check-device-uuid branch from c3e7b88 to 8d091a8 Compare January 13, 2026 02:29
@IvanOgurchenok IvanOgurchenok requested review from AleksZimin and astef and removed request for astef January 13, 2026 02:29
@IvanOgurchenok IvanOgurchenok marked this pull request as ready for review January 13, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Защититься от “перепутанных” дисков

1 participant