Skip to content
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

Fix collision of variable name with imported package name #64

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/source/openstack/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func (c *Client) GenerateVirtualMachine(vm *migration.VirtualMachineImport) (*ku
return nil, fmt.Errorf("error getting firware settings: %v", err)
}

networks, err := generateNetworkInfo(vmObj.Addresses)
networkInfos, err := generateNetworkInfo(vmObj.Addresses)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -451,7 +451,7 @@ func (c *Client) GenerateVirtualMachine(vm *migration.VirtualMachineImport) (*ku
},
}

mappedNetwork := mapNetworkCards(networks, vm.Spec.Mapping)
mappedNetwork := mapNetworkCards(networkInfos, vm.Spec.Mapping)
networkConfig := make([]kubevirt.Network, 0, len(mappedNetwork))
for i, v := range mappedNetwork {
networkConfig = append(networkConfig, kubevirt.Network{
Expand Down Expand Up @@ -700,7 +700,7 @@ func (c *Client) ImageFirmwareSettings(instance *servers.Server) (bool, bool, bo
}

func generateNetworkInfo(info map[string]interface{}) ([]networkInfo, error) {
networks := make([]networkInfo, 0)
networkInfos := make([]networkInfo, 0)
uniqueNetworks := make([]networkInfo, 0)
for network, values := range info {
valArr, ok := values.([]interface{})
Expand All @@ -712,7 +712,7 @@ func generateNetworkInfo(info map[string]interface{}) ([]networkInfo, error) {
if !ok {
return nil, fmt.Errorf("error asserting network array element into map[string]string")
}
networks = append(networks, networkInfo{
networkInfos = append(networkInfos, networkInfo{
NetworkName: network,
MAC: valMap["OS-EXT-IPS-MAC:mac_addr"].(string),
})
Expand All @@ -721,7 +721,7 @@ func generateNetworkInfo(info map[string]interface{}) ([]networkInfo, error) {
// in case of interfaces with ipv6 and ipv4 addresses they are reported twice, so we need to dedup them
// based on a mac address
networksMap := make(map[string]networkInfo)
for _, v := range networks {
for _, v := range networkInfos {
networksMap[v.MAC] = v
}

Expand Down
Loading