-
Notifications
You must be signed in to change notification settings - Fork 54
Allow multiple nics #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Allow multiple nics #153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for multiple network interfaces during CloudStack instance creation by adding a new network_ids field that accepts a list of network IDs as an alternative to the existing single network_id field.
- Adds
network_idsfield as a list type to support multiple network interfaces - Implements mutual exclusivity between
network_idandnetwork_idsfields using ConflictsWith - Updates instance creation logic to handle the new list-based network configuration
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if networks, ok := d.GetOk("network_ids"); ok { | ||
| var networkIds []string | ||
| for _, nw := range networks.([]interface{}) { | ||
| networkIds = append(networkIds, fmt.Sprintf("%v", nw)) |
Copilot
AI
Sep 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using fmt.Sprintf with %v is unnecessary and potentially unsafe for type conversion. Since the schema defines the element type as TypeString, cast directly to string: networkIds = append(networkIds, nw.(string))
| networkIds = append(networkIds, fmt.Sprintf("%v", nw)) | |
| networkIds = append(networkIds, nw.(string)) |
| for _, nw := range networks.([]interface{}) { | ||
| networkIds = append(networkIds, fmt.Sprintf("%v", nw)) | ||
| } | ||
| p.SetNetworkids(networkIds); |
Copilot
AI
Sep 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the semicolon at the end of the line. Go does not require semicolons at the end of statements.
| p.SetNetworkids(networkIds); | |
| p.SetNetworkids(networkIds) |
|
@JSpon Please check Copilot's comments and also update the documentation. |
|
@JSpon could you please let us know if you want the PR in the upcoming release? Currently, we need the PR to pass the tests and the conflicts must be resolved inorder to merge it |
Allows for multiple network ids on instance creation