Skip to content

Allow preserving duplicate MACs during VM import#13128

Open
andrijapanicsb wants to merge 1 commit intoapache:mainfrom
andrijapanicsb:allow-duplicate-mac-import
Open

Allow preserving duplicate MACs during VM import#13128
andrijapanicsb wants to merge 1 commit intoapache:mainfrom
andrijapanicsb:allow-duplicate-mac-import

Conversation

@andrijapanicsb
Copy link
Copy Markdown
Contributor

@andrijapanicsb andrijapanicsb commented May 7, 2026

Description

This change adds an explicit import option to preserve duplicate NIC MAC addresses during VM import workflows.

The existing forced option continues to mean: if the imported VM has a NIC MAC address that already exists on the selected CloudStack network, continue the import by generating a new MAC address.

A new allowduplicatemacaddresses API parameter allows the opposite behavior: preserve the imported VM's MAC address even if that same MAC is already present on the selected network. The two options are mutually exclusive.

This is useful for migration cutover workflows where a VMware-sourced VM is imported to KVM while the original VM still exists in CloudStack, but the operator wants the imported instance to keep the same MAC address for guest/network continuity.

The UI import form now labels forced as "Generate new MAC if required" and exposes a separate "Allow duplicate MAC addresses" switch.
These MAC conflict)ing) options are shown for VM migration/import flows where an existing source VM has NICs to preserve.
They are hidden when creating a brand-new VM from existing QCOW2 files on local/shared storage, because that path creates a new CloudStack NIC instead of importing a source NIC from another VM.

In other words, the MAC options are available when CloudStack has to decide what to do with a MAC address from a source VM: either keep it, generate a replacement, or fail on conflict. They are not shown for QCOW2 disk import, where there is no source VM NIC to preserve.

Types of changes

  • New feature
  • UI change
  • API change

Testing

  • mvn -pl api -am -DskipTests install
  • mvn -pl server -am -DskipTests compile
  • npm run lint -- --no-fix src/views/tools/ImportUnmanagedInstance.vue
  • Parsed ui/public/locales/en.json
  • git diff --check




##########################################################
Generated by AI - do you REALLY think I became a Java developer overnight?
So, REVIEW PROPERLY and feel free to decline the PR if it's bunch of junk !
#########################################################

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.52%. Comparing base (f6efda5) to head (b53c760).

❗ There is a different number of reports uploaded between BASE (f6efda5) and HEAD (b53c760). Click for more details.

HEAD has 3 uploads less than BASE
Flag BASE (f6efda5) HEAD (b53c760)
uitests 2 1
unittests 2 0
Additional details and impacted files
@@              Coverage Diff              @@
##               main   #13128       +/-   ##
=============================================
- Coverage     18.09%    3.52%   -14.57%     
=============================================
  Files          6037      464     -5573     
  Lines        542546    40170   -502376     
  Branches      66431     7562    -58869     
=============================================
- Hits          98159     1415    -96744     
+ Misses       433368    38567   -394801     
+ Partials      11019      188    -10831     
Flag Coverage Δ
uitests 3.52% <ø> (-0.01%) ⬇️
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@andrijapanicsb andrijapanicsb force-pushed the allow-duplicate-mac-import branch from 4621d57 to e35e8d7 Compare May 7, 2026 19:34
@andrijapanicsb
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@andrijapanicsb a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@andrijapanicsb andrijapanicsb force-pushed the allow-duplicate-mac-import branch from e35e8d7 to 8f46ffb Compare May 7, 2026 22:22
@andrijapanicsb
Copy link
Copy Markdown
Contributor Author

@blueorangutan help

@blueorangutan
Copy link
Copy Markdown

@andrijapanicsb [SL] I understand these words: "help", "hello", "thanks", "package", "test"
Test command usage: test [mgmt os] [hypervisor] [keepEnv] [qemuEv] [basicZone|securityGroups]
Mgmt OS options: ['suse15', 'alma10', 'ol10', 'rocky10', 'alma9', 'centos7', 'centos6', 'rocky9', 'alma8', 'ubuntu18', 'ol9', 'ol8', 'ubuntu22', 'debian12', 'ubuntu20', 'rocky8', 'ubuntu24']
Hypervisor options: ['kvm-centos6', 'kvm-centos7', 'kvm-rocky8', 'kvm-rocky9', 'kvm-rocky10', 'kvm-ol8', 'kvm-ol9', 'kvm-ol10', 'kvm-alma8', 'kvm-alma9', 'kvm-alma10', 'kvm-ubuntu18', 'kvm-ubuntu20', 'kvm-ubuntu22', 'kvm-ubuntu24', 'kvm-debian12', 'kvm-suse15', 'vmware-55u3', 'vmware-60u2', 'vmware-65u2', 'vmware-67u3', 'vmware-70u1', 'vmware-70u2', 'vmware-70u3', 'vmware-80', 'vmware-80u1', 'vmware-80u2', 'vmware-80u3', 'vmware-80u3e', 'xenserver-65sp1', 'xenserver-71', 'xenserver-74', 'xenserver-84', 'xcpng74', 'xcpng76', 'xcpng80', 'xcpng81', 'xcpng82', 'xcpng83']
Note: when keepEnv is passed, you need to specify mgmt server os and hypervisor or use the matrix command.
when qemuEv is passed, it will deploy KVM hyperviosr hosts with qemu-kvm-ev, else it will default to stock qemu.
When basicZone and/or securityGroups are passed it will create a zone of the last type specified (default is Advanced)
Package command usage: package [all(default value),kvm,xen,vmware,hyperv,ovm] - a comma separated list can be passed with package command to bundle the required hypervisor's systemVM templates. Not passing any argument will bundle all - kvm,xen and vmware templates.

Blessed contributors for kicking Trillian test jobs: ['rohityadavcloud', 'shwstppr', 'Damans227', 'vishesh92', 'Pearl1594', 'harikrishna-patnala', 'nvazquez', 'DaanHoogland', 'weizhouapache', 'borisstoyanov', 'vladimirpetrov', 'kiranchavala', 'andrijapanicsb', 'NuxRo', 'rajujith', 'alexandremattioli', 'sureshanaparti', 'abh1sar', 'sudo87', 'RosiKyu']

@andrijapanicsb andrijapanicsb force-pushed the allow-duplicate-mac-import branch from 8f46ffb to b53c760 Compare May 7, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants