feat(rest-api): Recovery of missing VPCs from Site inventory - #4460
feat(rest-api): Recovery of missing VPCs from Site inventory#4460hwadekar-nv wants to merge 5 commits into
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Summary by CodeRabbit
WalkthroughVPC inventory processing now loads active and soft-deleted records, validates inventory and referenced resources, restores eligible VPCs, creates missing VPCs, persists VNI data, and records reconciliation outcomes. ChangesVPC inventory recovery
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant SiteInventory
participant ManageVpc
participant VpcSQLDAO
participant Database
SiteInventory->>ManageVpc: Submit VPC inventory
ManageVpc->>VpcSQLDAO: Load active and deleted VPCs
ManageVpc->>Database: Validate ownership, allocations, and resources
ManageVpc->>VpcSQLDAO: Restore newer tombstone or create VPC
VpcSQLDAO->>Database: Persist VPC and Ready status detail
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
🧹 Nitpick comments (6)
rest-api/workflow/pkg/activity/vpc/vpc_test.go (2)
443-449: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument why the unmatched inventory entries do not trigger auto-creation.
The entries at lines 443-449 carry random controller UUIDs, so they match no existing record and now enter the recovery path. Auto-creation is suppressed only because this fixture never calls
testVPCSiteBuildAllocation, so recovery skips with "tenant does not have an active Allocation for the Site".The expectations therefore depend on the absence of an Allocation, which is invisible at the assertion site. If a future change adds an Allocation to this fixture, two VPCs are auto-created and several expectations break for reasons that are hard to trace.
Add a comment stating the dependency, or assert the resulting VPC count explicitly so the intent is enforced.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rest-api/workflow/pkg/activity/vpc/vpc_test.go` around lines 443 - 449, Clarify the fixture’s dependency on having no active Allocation for the Site around the unmatched inventory entries using a concise comment, or explicitly assert the resulting VPC count to enforce that auto-creation remains suppressed. Anchor the change near the entries using random controller UUIDs and preserve the existing expectations.
860-892: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winExtend the table to cover the resource-ownership skip branches.
The table covers three skip reasons. The security-relevant branches remain untested:
- "referenced Network Security Group belongs to a different Tenant or Site"
- "referenced NVLink Logical Partition belongs to a different Tenant or Site"
- "referenced NVLink Logical Partition is not Ready"
- "an active VPC with the same name already exists for the Tenant and Site"
- "tenant organization resolves to multiple REST Tenants"
These branches prevent inventory from attaching a resource owned by another tenant, which is the strongest justification for the validation code. The table structure already in place makes each addition a small fixture plus one row.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rest-api/workflow/pkg/activity/vpc/vpc_test.go` around lines 860 - 892, Extend the existing table-driven test around the current skip-reason cases to add fixtures and rows for all five untested branches: cross-tenant/site Network Security Group ownership, cross-tenant/site NVLink Logical Partition ownership, a non-Ready NVLink Logical Partition, an existing active same-name VPC, and an organization resolving to multiple REST Tenants. Reuse the test’s established setup and assert each branch’s exact skip reason, preserving the current table structure.rest-api/workflow/pkg/activity/vpc/vpc.go (2)
79-86: 🚀 Performance & Scalability | 🔵 TrivialConsider bounding the soft-deleted rows loaded on this inventory path.
This query now loads every VPC row for the Site, including soft-deleted rows, and it runs on every inventory page. Soft-deleted rows accumulate indefinitely unless a purge job removes them. Over time the tombstone set can exceed the active set, and the activity pays that cost repeatedly for a paginated inventory.
Two options reduce the exposure:
- Restrict the deleted rows to a recovery window, for example rows deleted within a recent retention period, because older tombstones can never satisfy the "inventory is newer than the delete marker" check anyway.
- Build the indexes once for the whole paginated inventory run instead of once per page, if the activity boundary allows it.
Neither is required for correctness. Both protect the hot path as tombstones grow.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rest-api/workflow/pkg/activity/vpc/vpc.go` around lines 79 - 86, Bound the soft-deleted VPC rows loaded by the GetAll call in the inventory path to a recent recovery/retention window, using the existing VpcFilterInput and established retention configuration or helper. Preserve active-row loading and the current pagination behavior; do not alter correctness for recently deleted records.
386-425: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftDecompose
recoverVpcFromInventoryinto named validation and write steps.This function spans roughly 340 lines and mixes six distinct responsibilities: proto validation, tenant resolution, allocation checks, dependency validation, name-conflict detection, and the locked write transaction. Every branch also repeats the verbose
util.InventoryRecoveryResult[*cdbm.Vpc]{Action: ..., Reason: ...}literal, which obscures the control flow.Consider introducing a small
vpcRecoverystruct that carriessite,inventory,controllerVpc,existingVpc, and the resolvedtenant, then splitting the body into receiver methods such asvalidateProto,resolveTenant,validateDependencies,checkNameConflict, andcommit. A localskip(reason string)helper would also remove the repeated generic literal.One detail deserves attention during that refactor. Lines 407-413 infer an invalid NVLink partition UUID by observing that the proto value is non-empty while
FromProtoproduced nil. That couples this function to the internal error handling ofFromProto. Parsing the UUID directly here would express the intent without the indirection.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rest-api/workflow/pkg/activity/vpc/vpc.go` around lines 386 - 425, Refactor recoverVpcFromInventory into named validation, tenant-resolution, dependency, conflict-check, and commit steps, using a vpcRecovery receiver that carries the shared inputs and resolved tenant. Add a local skip(reason string) helper to replace repeated InventoryRecoveryResult literals while preserving outcomes. In validateProto, parse controllerVpc.GetDefaultNvlinkLogicalPartitionId().GetValue() directly and skip when a non-empty value is not a valid UUID, instead of inferring invalidity from reportedVpc.NVLinkLogicalPartitionID after FromProto.Source: Path instructions
rest-api/db/pkg/db/model/vpc.go (2)
320-331: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winDocument that
VpcRestoreInputuses reset semantics, not PATCH semantics.Every optional field in
VpcRestoreInputis a pointer, which matches the shape ofVpcUpdateInput. The semantics differ.VpcUpdateInputtreats a nil pointer as "leave the column unchanged".Restorewrites every column in its fixed column set, so a nil pointer here clears the column. Callers can easily assume the wrong contract.State the reset contract in the doc comment so callers pass complete values.
📝 Proposed documentation change
// VpcRestoreInput contains the Site-owned fields refreshed while restoring a // soft-deleted VPC that is still reported by Site inventory. +// +// Unlike VpcUpdateInput, every field is written unconditionally: a nil pointer +// clears the corresponding column rather than preserving its previous value. +// Callers must supply the complete desired post-restore state. type VpcRestoreInput struct {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rest-api/db/pkg/db/model/vpc.go` around lines 320 - 331, Update the doc comment for VpcRestoreInput to explicitly state that restore uses reset semantics: every field in its fixed column set is written, and nil optional pointers clear the corresponding column rather than leaving it unchanged. Clarify that callers must provide complete values, and distinguish this contract from VpcUpdateInput’s PATCH semantics.
247-257: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsolidate the duplicate
uint32-to-intpointer helpers.cutil.Uint32PtrToIntPtrandutil.GetUint32PtrToIntPtrhave identical behavior, and workflow code already imports the common utility package. The documented VNI range is safe forint, including on 32-bit targets.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rest-api/db/pkg/db/model/vpc.go` around lines 247 - 257, The VNI conversion in the VPC model currently uses the duplicate cutil helper; replace cutil.Uint32PtrToIntPtr calls in the VPC mapping logic with the shared util.GetUint32PtrToIntPtr helper, update imports as needed, and remove the redundant helper if it is only used here.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rest-api/db/pkg/db/model/vpc_test.go`:
- Around line 1366-1448: The TestVpcSQLDAO_Restore test should be reorganized
into named table-driven t.Run subtests, following the pattern used by
TestVpcSQLDAO_DeleteByID. Keep the existing successful restore scenario, add a
case using an unknown VpcID that asserts db.ErrDoesNotExist, and add a case
passing nil optional fields that verifies Restore clears the corresponding
persisted columns. Use testify assertions and keep all cases organized under the
single top-level test.
In `@rest-api/workflow/pkg/activity/vpc/vpc_test.go`:
- Around line 704-843: Refactor
TestManageVpc_UpdateVpcsInDB_AutoCreatesAndRestores into named t.Run subtests
for creation, idempotent replay, newer-snapshot restoration, and older-snapshot
rejection, preserving the required phase order and shared setup. In the
restoration subtest, additionally assert ControllerVpcID, Vni, ActiveVni, and
RoutingProfile retain the expected values after restoration, using testify
assertions and the existing DAO results.
In `@rest-api/workflow/pkg/activity/vpc/vpc.go`:
- Around line 641-663: Update rest-api/workflow/pkg/activity/vpc/vpc.go lines
641-663 to resolve RoutingProfile from reportedVpc first and fall back to
deletedVpc.RoutingProfile when nil, then pass that resolved value to
VpcSQLDAO.Restore via VpcRestoreInput. In rest-api/db/pkg/db/model/vpc.go lines
320-331, document on VpcRestoreInput that all fields are written
unconditionally, nil clears the corresponding column, and callers must provide
the complete post-restore state.
- Around line 512-536: Update the NVLink Logical Partition validation around
nvLinkLogicalPartitionID to distinguish restoration from new inventory creation:
always retain the existing existence and Site/Tenant ownership checks, but
enforce NVLinkLogicalPartitionStatusReady only when the reference originates
from inventory. Allow restoration of an unchanged soft-deleted VPC with a
non-Ready partition, while preserving the current skip behavior for new
inventory references.
- Around line 626-639: Update the recovery logic around timestamp and
deletedVpc.Deleted so missing or invalid inventory timestamps return a reason
identifying the payload as malformed, while a valid timestamp not newer than the
soft-delete marker returns a distinct stale-inventory reason. Keep both branches
returning InventoryRecoverySkipped and preserve the existing valid-newer flow.
- Around line 572-577: Update the transaction callback in UpdateVpcsInDB around
TryAcquireAdvisoryLock to detect cdb.ErrXactAdvisoryLockFailed and return
InventoryRecoverySkipped instead of an error. Continue wrapping and propagating
all other lock-acquisition errors as activity failures.
- Around line 542-561: Add authoritative active-VPC name uniqueness by creating
a partial unique index on site_id, tenant_id, and name for non-deleted/active
rows, then update the VPC creation flow around vpcDAO.GetAll to detect that
constraint violation and return InventoryRecoverySkipped with the existing
conflict reason. Ensure concurrent inserts cannot bypass the guard; do not rely
solely on the pre-transaction query or controller VPC ID advisory lock.
- Around line 467-480: Update the allocation filter used by GetCount in the VPC
recovery flow to set Statuses to the active allocation states that authorize
recovery, while retaining the tenant and site filters. Add regression coverage
confirming allocations in Error and Deleting states are excluded from recovery.
---
Nitpick comments:
In `@rest-api/db/pkg/db/model/vpc.go`:
- Around line 320-331: Update the doc comment for VpcRestoreInput to explicitly
state that restore uses reset semantics: every field in its fixed column set is
written, and nil optional pointers clear the corresponding column rather than
leaving it unchanged. Clarify that callers must provide complete values, and
distinguish this contract from VpcUpdateInput’s PATCH semantics.
- Around line 247-257: The VNI conversion in the VPC model currently uses the
duplicate cutil helper; replace cutil.Uint32PtrToIntPtr calls in the VPC mapping
logic with the shared util.GetUint32PtrToIntPtr helper, update imports as
needed, and remove the redundant helper if it is only used here.
In `@rest-api/workflow/pkg/activity/vpc/vpc_test.go`:
- Around line 443-449: Clarify the fixture’s dependency on having no active
Allocation for the Site around the unmatched inventory entries using a concise
comment, or explicitly assert the resulting VPC count to enforce that
auto-creation remains suppressed. Anchor the change near the entries using
random controller UUIDs and preserve the existing expectations.
- Around line 860-892: Extend the existing table-driven test around the current
skip-reason cases to add fixtures and rows for all five untested branches:
cross-tenant/site Network Security Group ownership, cross-tenant/site NVLink
Logical Partition ownership, a non-Ready NVLink Logical Partition, an existing
active same-name VPC, and an organization resolving to multiple REST Tenants.
Reuse the test’s established setup and assert each branch’s exact skip reason,
preserving the current table structure.
In `@rest-api/workflow/pkg/activity/vpc/vpc.go`:
- Around line 79-86: Bound the soft-deleted VPC rows loaded by the GetAll call
in the inventory path to a recent recovery/retention window, using the existing
VpcFilterInput and established retention configuration or helper. Preserve
active-row loading and the current pagination behavior; do not alter correctness
for recently deleted records.
- Around line 386-425: Refactor recoverVpcFromInventory into named validation,
tenant-resolution, dependency, conflict-check, and commit steps, using a
vpcRecovery receiver that carries the shared inputs and resolved tenant. Add a
local skip(reason string) helper to replace repeated InventoryRecoveryResult
literals while preserving outcomes. In validateProto, parse
controllerVpc.GetDefaultNvlinkLogicalPartitionId().GetValue() directly and skip
when a non-empty value is not a valid UUID, instead of inferring invalidity from
reportedVpc.NVLinkLogicalPartitionID after FromProto.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: f1ea5f79-1387-4c03-8773-9e454ed24c85
📒 Files selected for processing (5)
rest-api/db/pkg/db/model/vpc.gorest-api/db/pkg/db/model/vpc_test.gorest-api/workflow/pkg/activity/vpc/vpc.gorest-api/workflow/pkg/activity/vpc/vpc_test.gorest-api/workflow/pkg/util/common.go
🔐 TruffleHog Secret Scan✅ No secrets or credentials found! Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉 🕐 Last updated: 2026-07-31 21:00:31 UTC | Commit: 900dba9 |
|
@coderabbitai full_review !! |
|
🐇🔍 ✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
rest-api/workflow/pkg/activity/vpc/vpc.go (2)
387-394: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffConsider decomposing
recoverVpcFromInventory.The method spans roughly 390 lines and mixes payload normalization, tenant resolution, allocation authorization, dependency validation, lock acquisition, identity reload, name arbitration, restoration, and creation. Each stage returns the same result type, so extraction is mechanical. Receiver methods such as
validateInventoryOwnership,resolveRecoveryIdentity, andapplyRecoverywould make the control flow readable and testable in isolation. The existing table-driven tests would then target the individual stages directly.This is a maintainability improvement only. The current behavior is correct.
As per path instructions: "Review Go code for correctness, clean control flow, error handling, context propagation, test coverage, performance, and cohesive organization around well-defined, well-named structs with receiver functions when behavior belongs to a domain type."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rest-api/workflow/pkg/activity/vpc/vpc.go` around lines 387 - 394, Decompose ManageVpc.recoverVpcFromInventory into focused receiver methods for payload normalization, ownership and identity resolution, allocation authorization, dependency validation, locking, name arbitration, and restoration or creation. Preserve the existing result and error behavior while making the top-level method a readable orchestration flow, and update the table-driven tests to exercise the extracted stages directly.Source: Path instructions
428-491: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winConsider moving the ownership and dependency reads inside the transaction.
The tenant lookup, the allocation count, the Network Security Group check, and the NVLink Logical Partition check all run before
cdb.WithTxResultopens the transaction. The advisory locks serialize concurrent inventory recovery, but they do not serialize allocation or dependency changes made by other flows. A tenant Allocation can move toDeletingafter line 486 and before the insert at line 732. The activity then creates a VPC for a tenant that is no longer authorized for the Site.Passing
txto these DAO reads inside the closure would make the authorization decision and the write atomic. The reads are alreadytx-capable, so the change is contained.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rest-api/workflow/pkg/activity/vpc/vpc.go` around lines 428 - 491, Move the tenant lookup and allocation authorization reads from the pre-transaction section into the cdb.WithTxResult closure, passing the transaction handle to the tenant and allocation DAO methods. Also move the Network Security Group and NVLink Logical Partition dependency checks into that same transaction, so all ownership and dependency decisions use a consistent snapshot immediately before the VPC write; preserve the existing skip and error outcomes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rest-api/workflow/pkg/activity/vpc/vpc_test.go`:
- Around line 879-888: Update the status detail assertions after
statusDetailDAO.GetAll to search all returned statusDetails for the expected
“VPC restored from Site inventory” message instead of assuming it is at index 0.
Preserve the existing count and non-nil message validations while making the
restoration-message assertion independent of result ordering.
In `@rest-api/workflow/pkg/activity/vpc/vpc.go`:
- Around line 649-655: Use the reloaded transactional row deletedVpc, rather
than the pre-transaction snapshot existingVpc, as the identity source throughout
the VPC name-conflict flow. Update both the name derivation near the existing
name assignment and the ID exemption in the vpcsWithName loop, preserving the
create-path behavior when no deletedVpc is reloaded so active same-name VPCs are
not skipped.
---
Nitpick comments:
In `@rest-api/workflow/pkg/activity/vpc/vpc.go`:
- Around line 387-394: Decompose ManageVpc.recoverVpcFromInventory into focused
receiver methods for payload normalization, ownership and identity resolution,
allocation authorization, dependency validation, locking, name arbitration, and
restoration or creation. Preserve the existing result and error behavior while
making the top-level method a readable orchestration flow, and update the
table-driven tests to exercise the extracted stages directly.
- Around line 428-491: Move the tenant lookup and allocation authorization reads
from the pre-transaction section into the cdb.WithTxResult closure, passing the
transaction handle to the tenant and allocation DAO methods. Also move the
Network Security Group and NVLink Logical Partition dependency checks into that
same transaction, so all ownership and dependency decisions use a consistent
snapshot immediately before the VPC write; preserve the existing skip and error
outcomes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 8dac8c1b-89b4-4467-ad71-ef566924e317
📒 Files selected for processing (5)
rest-api/db/pkg/db/model/vpc.gorest-api/db/pkg/db/model/vpc_test.gorest-api/workflow/pkg/activity/vpc/vpc.gorest-api/workflow/pkg/activity/vpc/vpc_test.gorest-api/workflow/pkg/util/common.go
|
@coderabbitai full_review !! |
|
🐇🔍 ✅ Action performedFull review finished. |
|
🌿 Preview your docs: https://nvidia-preview-pull-request-4460.docs.buildwithfern.com/infra-controller |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
rest-api/workflow/pkg/activity/vpc/vpc.go (1)
390-397: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider splitting
recoverVpcFromInventoryinto validation and apply stages.The method spans roughly 390 lines and mixes four responsibilities: proto normalization, ownership resolution, dependency validation, and the transactional write. The logic is correct, but each stage is currently only reachable through the full method, which makes targeted unit tests and future reuse for other inventory types harder.
An elegant decomposition keeps
recoverVpcFromInventoryas a thin orchestrator:
resolveInventoryVpcOwnerreturns the tenant plus the normalizedreportedVpc, or a skip result.validateInventoryVpcDependenciesperforms the NSG and NVLink Logical Partition checks.applyVpcRecoveryholds thecdb.WithTxResultbody.This also isolates the two advisory-lock paths, which are the parts most likely to change when recovery is extended beyond VPCs.
As per path instructions: "Review Go code for ... cohesive organization around well-defined, well-named structs with receiver functions when behavior belongs to a domain type."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rest-api/workflow/pkg/activity/vpc/vpc.go` around lines 390 - 397, Refactor recoverVpcFromInventory into a thin orchestrator by extracting proto normalization and ownership handling into resolveInventoryVpcOwner, NSG and NVLink Logical Partition checks into validateInventoryVpcDependencies, and the cdb.WithTxResult transactional write into applyVpcRecovery. Preserve existing skip results, validation behavior, advisory-lock paths, and recovery outcomes while making each stage independently testable.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@rest-api/workflow/pkg/activity/vpc/vpc.go`:
- Around line 390-397: Refactor recoverVpcFromInventory into a thin orchestrator
by extracting proto normalization and ownership handling into
resolveInventoryVpcOwner, NSG and NVLink Logical Partition checks into
validateInventoryVpcDependencies, and the cdb.WithTxResult transactional write
into applyVpcRecovery. Preserve existing skip results, validation behavior,
advisory-lock paths, and recovery outcomes while making each stage independently
testable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: c5c9aa97-858d-42da-801b-d96f1f97a152
📒 Files selected for processing (5)
rest-api/db/pkg/db/model/vpc.gorest-api/db/pkg/db/model/vpc_test.gorest-api/workflow/pkg/activity/vpc/vpc.gorest-api/workflow/pkg/activity/vpc/vpc_test.gorest-api/workflow/pkg/util/common.go
Preserve restored state and skip unsafe recovery attempts while expanding regression coverage. Signed-off-by: Hitesh Wadekar <hwadekar@nvidia.com>
Use the row reloaded under lock and make status assertions order-independent. Signed-off-by: Hitesh Wadekar <hwadekar@nvidia.com>
Let later inventory cycles retry failed VPCs without blocking the current page. Signed-off-by: Hitesh Wadekar <hwadekar@nvidia.com>
Consolidate recovery warnings and include VPC identity in recovery outcomes. Signed-off-by: Hitesh Wadekar <hwadekar@nvidia.com>
edd6e28 to
42fa338
Compare
Description
Site inventory previously skipped VPCs (which are existed in Site) that had no active REST database record, leaving Site and REST state inconsistent. This PR reconciles those VPCs using their controller ID.
Soft-deleted VPCs are restored when reported by a newer inventory snapshot, while true orphans are auto-created after validating tenant ownership, Site allocation, NSG, NVLink partition, and name conflicts. Recovery writes are transactional and retry-safe.
Related issues
This PR part of the issue (#3436)
Type of Change
Testing
Tests executed:
make test-workflow
make test-db
go vet ./workflow/pkg/util ./workflow/pkg/activity/vpc
Additional Notes