Skip to content

fix: spored reliably mounts async ephemeral FSx (#221) - #253

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/221-async-fsx-mount
Jun 25, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/221-async-fsx-mount

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Summary

Closes #221. On a lagotto-launched instance with ephemeral --fsx-create, the FSx reached AVAILABLE but spored never mounted it — empty /fsx, workload hanging, and tellingly no spored log lines at all. Root-caused to two independent bugs, either of which alone produces the silent no-op:

1. Startup race (primary)

mountPendingFSx ran exactly once at monitor start (agent.go), reading spawn:fsx-pending immediately. But the launch path writes that tag after RunInstances (the FSx create + EnsureLustrePorts add seconds), and EC2 tags are eventually consistent — so the tag was frequently absent at that single read. The periodic RefreshConfig later populated FSxPending, but nothing re-invoked the mount, and the FSxPending == "" early return logs nothing → exactly the "no log lines" symptom.

Fix: drive the mount from the monitor loop (maybeMountPendingFSx in checkAndAct, after each config refresh), idempotent via fsxMountStarted. A tag that lands after spored boots is now picked up and mounted once.

2. Missing IAM (also fatal)

The spored inline policy had no fsx:* permissions, so even with the tag present the mount would fail AccessDenied on fsx:DescribeFileSystems / fsx:CreateDataRepositoryAssociation. (Same class as the #212 reaper-FSx-perms gap.)

Fix: buildInlinePolicy now grants fsx:DescribeFileSystems, fsx:CreateDataRepositoryAssociation, fsx:DescribeDataRepositoryAssociations. Re-applied on every launch via updateInlinePolicy, so both CLI and lagotto/headless instances get it on next launch (no manual IAM migration for the role).

Tests

  • TestMaybeMountPendingFSx_GatingAndIdempotency — no-pending → not started (re-checks later); pending → started exactly once.
  • TestSporedFSxMountGrant — the FSx APIs are in the spored policy.
  • Updated TestBuildInlinePolicy statement counts (4 → 5).
  • make check green.

Note

The IAM grant reaches an instance's role on its next launch (the inline policy is re-applied at launch). Already-running agentless instances from before this fix are unaffected; relaunch to pick it up.

Two independent bugs each made the async FSx mount (#194) silently never fire —
no log lines, empty mount point, workload hanging (hit on the BuckAI/fieldwork
SAM beta):

1. Startup race. mountPendingFSx ran exactly once at monitor start, reading
   spawn:fsx-pending immediately. The launch path tags the instance AFTER
   RunInstances (FSx create + EnsureLustrePorts take seconds) and EC2 tags are
   eventually consistent, so the tag was frequently absent at that single read.
   The periodic RefreshConfig later populated FSxPending, but nothing re-invoked
   the mount → silent no-op (the FSxPending=="" early return logs nothing). Now
   driven from the monitor loop (maybeMountPendingFSx in checkAndAct, after the
   config refresh), idempotent via fsxMountStarted, so a tag landing after boot
   is picked up and mounted once.

2. Missing IAM. The spored inline policy had NO fsx:* perms, so even with the
   tag present the mount failed AccessDenied on fsx:DescribeFileSystems /
   fsx:CreateDataRepositoryAssociation. buildInlinePolicy now grants those (+
   DescribeDataRepositoryAssociations); re-applied on every launch via
   updateInlinePolicy, covering both CLI and lagotto/headless paths.

Tests: maybeMountPendingFSx gating+idempotency; spored FSx-mount IAM grant;
updated buildInlinePolicy statement counts (4->5). make check green.

Fixes #221.
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 36f3256 into main Jun 25, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/221-async-fsx-mount branch June 25, 2026 17:19
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.

spored did not mount the async-created ephemeral FSx after it reached AVAILABLE (no mount, no log lines) — #194 not firing

1 participant