Skip to content

Commit

Permalink
ocp: copy loop var when iterating over interfaces
Browse files Browse the repository at this point in the history
Otherwise we end up using the variable which we copy over the same
interface and keep the type

Signed-off-by: Benny Zlotnik <[email protected]>
  • Loading branch information
bennyz authored and ahadas committed Aug 15, 2023
1 parent 69d50c3 commit 914c433
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/controller/plan/adapter/ocp/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,9 @@ func (r *Builder) mapNetworks(sourceVm *cnv.VirtualMachine, targetVmSpec *cnv.Vi
// Map networks to NICs
interfacesMap := make(map[string]*cnv.Interface)
for _, ifc := range sourceVm.Spec.Template.Spec.Domain.Devices.Interfaces {
currentInterface := ifc
networkName := ifc.Name
interfacesMap[networkName] = &ifc
interfacesMap[networkName] = &currentInterface
}

var kInterface *cnv.Interface
Expand Down

0 comments on commit 914c433

Please sign in to comment.