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

Address network duplication during import process #43

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

ibrokethecloud
Copy link
Collaborator

IMPORTANT: Please do not create a Pull Request without creating an issue first.

Problem:

In case cases as reported by the linked issue, the nic's are duplicated in the imported VM.

There are different causes for this behaviour.

In case of openstack, if the network is dual stacked, then the api reports the network interface details twice, once with ipv4 and ipv6 addressing which causes the additional network mapping to appear. This is now fixed with a dedup of nics based on mac addresses

in case of vmware, this behaviour only happens when the same sourceNetwork appears in the import spec twice, without that multi-homed VM's get imported without any nic duplication. For example the following spec will trigger the duplication of nics. The easy fix is to dedup the source networks during the preflight check to allow the user to fix their network definitions and allow user to correct the spec.

apiVersion: migration.harvesterhci.io/v1beta1
kind: VirtualMachineImport
metadata:
  name: ubuntu-import
  namespace: default
spec:
  virtualMachineName: "gm-ubuntu-test"
  networkMapping:
  - sourceNetwork: "VM Network"
    destinationNetwork: "default/workload"
  - sourceNetwork: "VM Network"
    destinationNetwork: "default/workload"
  sourceCluster:
    name: wrangler
    namespace: default
    kind: VmwareSource
    apiVersion: migration.harvesterhci.io/v1beta1

Solution:

PR introduces two minor fixes:

  • dedup network info for openstack vm's based on mac addresses to avoid creating a nic in imported VM for each match of source to destination network
  • dedup source network for VMs during preflight checks to avoid same nic being mapped twice for the same source network

Related Issue:
harvester/harvester#6451
Test plan:

@bk201 bk201 requested review from starbops and votdev September 11, 2024 06:04
@ibrokethecloud ibrokethecloud force-pushed the issue-6451 branch 2 times, most recently from 2467162 to 2232454 Compare September 11, 2024 06:47
…v6 and ipv4 addresses and add preflight check to identify duplicate source network definitions
Copy link
Member

@votdev votdev left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@starbops starbops left a comment

Choose a reason for hiding this comment

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

LGTM, thank you.

@starbops starbops merged commit 03a8ef0 into harvester:main Oct 7, 2024
4 checks passed
@ibrokethecloud
Copy link
Collaborator Author

@Mergifyio backport v1.3

Copy link

mergify bot commented Dec 8, 2024

backport v1.3

✅ Backports have been created

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.

3 participants