-
Notifications
You must be signed in to change notification settings - Fork 12
improve network lookup for vmware source imports #70
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?
improve network lookup for vmware source imports #70
Conversation
0807758
to
cd068e6
Compare
… vm's to allow importing of VM's using Dswitch backed networks change how network name lookup is perform when importing vmware based vm's to allow importing of VM's using Dswitch backed networks
cd068e6
to
2ff4763
Compare
case *types.VirtualEthernetCardNetworkBackingInfo: | ||
obj := b | ||
summary = obj.DeviceName | ||
} |
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.
The return variable is already set to empty, but to simplify reading the code I would add a default case to the switch statement. In this case it is totally clear what happens.
} | |
default: | |
summary = "" | |
} |
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.
LGTM + the small suggestion
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.
LGTM, thanks.
waiting on feedback from end user who is running a dev build to validate the changes |
5eadbfd
@@ -92,4 +92,5 @@ const ( | |||
VirtualMachineImageFailed condition.Cond = "VirtualMachineImageFailed" | |||
VirtualMachineExportFailed condition.Cond = "VMExportFailed" | |||
VirtualMachineMigrationFailed ImportStatus = "VMMigrationFailed" | |||
SkipPreflightChecks string = "harvesterhci.io/skip-preflight-checks" |
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.
Could you explain why you prefer using an annotation over adding a new field to VirtualMachineImportSpec
?
@@ -91,6 +93,11 @@ func NewClient(ctx context.Context, endpoint string, dc string, secret *corev1.S | |||
vmwareClient.ctx = ctx | |||
vmwareClient.Client = c | |||
vmwareClient.dc = dc | |||
networkMap, err := GenerateNetworkMapByRef(ctx, c.Client) | |||
if err != nil { | |||
return nil, fmt.Errorf("error generating network map during client initialisation: %v", err) |
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.
return nil, fmt.Errorf("error generating network map during client initialisation: %v", err) | |
return nil, fmt.Errorf("error generating network map during client initialisation: %w", err) |
IMPORTANT: Please do not create a Pull Request without creating an issue first.
Problem:
Imports from vmware source where the VM is using a network backed by a Dswitch get mapped to pod network and not the correct target vlan in harvester.
This happens because of the way summary of a nic is represented when using a dswitch backed network.
Solution:
Add additional logic in the vmware import process to identify backing device for a nic and process network names accordingly.
In case of dswitched backed networks we identify the PortGroupKey for nic and use the same to lookup actual vm network name.
Related Issue:
harvester/harvester#7774
Test plan: