Skip to content

fix(pnfs): activate a metadata server guest that boots as a standby - #906

Merged
boddumanohar merged 1 commit into
mainfrom
fix/mds-activate-standby-guest
Nov 12, 2026
Merged

boddumanohar merged 1 commit into
mainfrom
fix/mds-activate-standby-guest

Conversation

@boddumanohar

Copy link
Copy Markdown
Member

Problem

pNFS is down on main. Every MDS image built from the moving spdkcsi:pnfsos tag since vela-os pnfs-minimal merged the warm-standby boot (7eee8a4, PR #30) never becomes healthy:

guest unhealthy: the state disk is not mounted at /var/lib/nfs
MDS runner: guest did not turn healthy within the boot deadline (2m0s)

The standby guest no longer mounts its state disk at boot, and nfs-server, nfs-mountd, and nfsdcld wait for /run/mds/active, which only a promotion creates. mds-agent is built from this repository and written into the guest disk, and the agent on main never promotes, so the guest waits forever and the runner restarts the pod at its boot deadline.

Fix

mds-agent activates the guest at startup, retrying until it succeeds:

  1. Mount the state disk (/dev/disk/by-id/virtio-pnfs-state) at /var/lib/nfs as ext4 with noatime, as the old image's fstab did. It is formatted only when blkid exits 2 (no filesystem). A blkid that fails otherwise fails the attempt, so an unreadable disk is never formatted over the client-recovery database.
  2. Run systemd-tmpfiles --create /usr/lib/tmpfiles.d/pnfs.conf, which recreates what the mount hides.
  3. Create /run/mds/active.
  4. Start nfsdcld, nfs-mountd, and nfs-server, in that order.

On an older image that mounts the state disk and starts nfsd at boot, every step finds its work done, so the agent works with both guests. The change is minimal on purpose: promotion, fencing, and the reservation key belong to the warm-standby implementation, a separate PR that replaces this self-activation with operator-driven promotion.

Tests

  • TestAGuestBootedAsAStandbyIsActivated, TestABlankStateDiskIsFormattedFirst, and TestAnUnreadableStateDiskIsNeverFormatted (regression, U-117) failed against a stub that did nothing and pass with the fix. TestAGuestAlreadyServingIsLeftAsItIs covers the older image.
  • go test -race ./internal/mds/agent/, a Linux build and vet of cmd/mds-agent, golangci-lint, and the house-style gate pass.
  • On a cluster: a four-node k3s cluster ran an MDS image with this change and a standby guest (pnfsos-95b667b, pnfs-minimal plus pnfs-common: shorten the metadata server's NFSv4 lease and grace time to 15 s vela-os#32). The agent logged the guest is active: state disk mounted at /var/lib/nfs, nfsd started, nfsd started, the export went Ready, and four pNFS writers ran with no stalls. The MDS was then evicted, and later moved to another node by a drain, and came up active each time. The same cluster with main's agent and the same guest generation never turned healthy.

The guest image moved to a warm-standby boot (vela-os 7eee8a4): the state disk
is no longer mounted at boot, and nfs-server, nfs-mountd, and nfsdcld wait for
/run/mds/active, which only a promotion creates. Nothing in this operator
promotes the guest, so every metadata server built from the moving pnfsos tag
reported "the state disk is not mounted" until its boot deadline restarted the
pod, and pNFS was down on every cluster that picked the image up.

mds-agent now activates the guest at startup: it mounts the state disk
(formatting it only when blkid reports no filesystem, never when blkid fails),
recreates what the mount hides, creates the gate file, and starts the nfsd
units, retrying until that succeeds. On an image that still mounts the state
disk and starts nfsd at boot, every step finds its work done. Promotion,
fencing, and the reservation key stay with the standby implementation, which
replaces this self-activation.
@boddumanohar
boddumanohar merged commit 4f3d487 into main Nov 12, 2026
23 checks passed
@boddumanohar
boddumanohar deleted the fix/mds-activate-standby-guest branch November 12, 2026 08:56
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.

2 participants