Skip to content

Fix NIC attachment response handling - #353

Open
bddvlpr wants to merge 1 commit into
apache:mainfrom
bddvlpr:fix/nic-attach
Open

bddvlpr wants to merge 1 commit into
apache:mainfrom
bddvlpr:fix/nic-attach

Conversation

@bddvlpr

@bddvlpr bddvlpr commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

This PR fixes NIC attachment failures by populating the state directly from the addNicToVirtualMachine response instead of immediatly refreshing the instance (this can cause drift).

NIC refreshes now use listNics with the instance and NIC IDs. The configured instance ID is preserved when the API response omits it, and missing or duplicate NIC responses are handled explicitly.

Copilot AI lite review requested due to automatic review settings September 17, 2026 12:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Refresh handling must preserve missing-instance behavior after the instance is deleted.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This pull request improves NIC attachment state handling and targeted refresh behavior.

Changes:

  • Populates NIC state from the attachment response.
  • Refreshes NICs using instance and NIC IDs.
  • Preserves omitted instance IDs and handles missing or duplicate responses.
File summaries
File Description
cloudstack/resource_cloudstack_nic.go Revises NIC creation, refresh, and state population logic.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +103 to 105
l, err := cs.Nic.ListNics(p)
if err != nil {
return err
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