Skip to content

Fix GRE tunnel create check and Exists error handling - #2239

Open
ksamoray wants to merge 1 commit into
vmware:branch_3122from
ksamoray:b3122/fix/2207-gre-tunnel-create-check
Open

Fix GRE tunnel create check and Exists error handling#2239
ksamoray wants to merge 1 commit into
vmware:branch_3122from
ksamoray:b3122/fix/2207-gre-tunnel-create-check

Conversation

@ksamoray

Copy link
Copy Markdown
Contributor

Summary

  • resourceNsxtPolicyTier0GatewayGRETunnelExists returned true, nil for any non-not-found error, including real API failures.
  • Create never checked for a colliding explicit nsx_id before issuing the Patch, silently overwriting an existing GRE tunnel instead of rejecting the create.
  • Fix Exists to only report true when the Get succeeds, propagate real errors instead of misreporting them as existing, and have Create reject a colliding explicit nsx_id up front.

Hand-adapted port of the equivalent master fix: master's version of this file uses a different (SDK-wrapper-refactor) client-construction pattern not present on this branch, and the full source PR (#2207) bundled this fix with an unrelated 36-file "move test-only Exists helpers into _test.go files" refactor touching many resources absent from this branch (including several Transit-Gateway-routing-child resources). Only the isolated GRE tunnel logic fix is included here, rewritten against this branch's actual client-construction code.

Test plan

  • go build ./...
  • go vet ./...
  • gofmt -l . (clean)
  • golangci-lint run ./nsxt/ (0 issues)

Note: CI's lint job's make tools step was previously expected to fail on PRs against this branch pending #2234's Go-version bump — that has since merged, so this should be unaffected.

@ksamoray
ksamoray requested a review from a team August 20, 2026 15:35
@ksamoray

ksamoray commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

/test-all

@ksamoray
ksamoray force-pushed the b3122/fix/2207-gre-tunnel-create-check branch from 8b7cf77 to c952b46 Compare September 3, 2026 09:49
resourceNsxtPolicyTier0GatewayGRETunnelExists returned true, nil for
any non-not-found error, including real API failures. Create also
never checked for a colliding explicit nsx_id before issuing the
Patch, silently overwriting an existing GRE tunnel instead of
rejecting the create.

Fix Exists to only report true when the Get succeeds, propagate real
errors instead of misreporting them as existing, and have Create
reject a colliding explicit nsx_id up front.
@ksamoray
ksamoray force-pushed the b3122/fix/2207-gre-tunnel-create-check branch from c952b46 to c2d8b6f Compare September 8, 2026 10:46
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