Skip to content

fix: --fsx-create honors --az by resolving it to a co-located subnet (#208) - #209

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/208-fsx-az-subnet
Jun 17, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/208-fsx-az-subnet

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Closes #208.

The bug

--az set the EC2 instance placement but never reached the FSx create. cmd/launch.go passes config.SubnetID to the FSx config, but config.SubnetID is never assigned in the main launch path — so startFSxCreate fell back to subnets[0] of the default VPC, ignoring --az entirely.

Two consequences:

  1. Unmountable cross-AZ FSx — the instance honored --az, the FSx used subnets[0]; if they differ, the mount can't work (FSx Lustre is single-AZ).
  2. A per-AZ-availability illusion — a field report hit PERSISTENT_2 is not available in this availability zone on --az us-east-1a, 1b, 1c, identical text each time. They were all the same subnets[0], not three AZs. On an account whose subnets[0] AZ doesn't offer PERSISTENT_2, every --az fails identically.

Proof it's not AWS

Direct CreateFileSystem PERSISTENT_2 probe (raw CLI, explicit subnet per AZ, deleted + leak-checked), two runs, all 6 us-east-1 AZs:

AZ AZ ID Run 1 Run 2
us-east-1a use1-az1 ✅ ✅
us-east-1b use1-az2 ✅ ✅
us-east-1c use1-az4 ✅ ✅
us-east-1d use1-az6 ✅ ✅
us-east-1e use1-az3 ❌ ❌
us-east-1f use1-az5 ✅ ✅

AWS accepts PERSISTENT_2 in the exact AZs the report "failed" on (also verified with LZ4 compression and 125/250 throughput — all succeed).

Fix

  • GetSubnetForAZ(region, az) (pkg/aws/fsx.go) — DescribeSubnets filtered by availability-zone in the default VPC.
  • NeedsAZSubnetResolution(pinnedSubnet, pinnedAZ) — pure, unit-tested decision: resolve iff no subnet is pinned and an AZ is. Explicit subnet wins; no-AZ-no-subnet keeps the default-VPC fallback (matching the instance's own unpinned placement).
  • Wired into both cmd/launch.go and pkg/launcher/provision.go (headless / lagotto), so the FSx co-locates with the instance's AZ.

Tests

TestNeedsAZSubnetResolution table test (4 cases). go build ./..., go vet, pkg/aws + pkg/launcher suites green; gofmt clean.

Note: GetSubnetForAZ itself makes a live DescribeSubnets call (substrate doesn't model the AZ filter), so the branching decision is what's unit-tested; the resolver is exercised by the real launch path. The two-run probe above is the live evidence the underlying create works per-AZ.

…208)

--az set the EC2 instance placement but never reached the FSx create, which
fell back to subnets[0] of the default VPC regardless of --az. Two bugs:
1. The FSx could land in a different AZ than the instance — an unmountable
   cross-AZ FSx (Lustre is single-AZ; the mounting instance must share its AZ).
2. On accounts whose subnets[0] AZ doesn't offer PERSISTENT_2, EVERY --az value
   failed identically with 'PERSISTENT_2 is not available in this availability
   zone' — a per-AZ-availability illusion that was really the same wrong subnet
   each time. Verified via a direct CreateFileSystem probe (2 runs, all 6
   us-east-1 AZs, deleted + leak-checked): AWS accepts PERSISTENT_2 in 5/6 AZs
   including the reported-failing 1a/1b/1c.

Fix: resolve a pinned --az to a default-VPC subnet (GetSubnetForAZ) before
creating the FSx, so it co-locates with the instance. NeedsAZSubnetResolution
is the pure, unit-tested decision (resolve iff no subnet pinned AND an AZ is).
Applied in both cmd/launch.go and pkg/launcher/provision.go (headless). An
explicit pinned subnet still wins; no-AZ-no-subnet keeps the default fallback.

Closes #208
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 3.84615% with 50 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/aws/fsx.go 8.33% 22 Missing ⚠️
cmd/launch.go 0.00% 20 Missing ⚠️
pkg/launcher/provision.go 0.00% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit bf7e71a into main Jun 17, 2026
6 of 7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/208-fsx-az-subnet branch June 17, 2026 02: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.

[FSx] --fsx-create ignores --az: filesystem always lands in subnets[0], not the pinned AZ

1 participant