Skip to content

[VMware to KVM] Add guest OS for importing VM based on the source VM OS#12802

Open
nvazquez wants to merge 5 commits intoapache:4.22from
shapeblue:422-vmware-to-kvm-guestos
Open

[VMware to KVM] Add guest OS for importing VM based on the source VM OS#12802
nvazquez wants to merge 5 commits intoapache:4.22from
shapeblue:422-vmware-to-kvm-guestos

Conversation

@nvazquez
Copy link
Contributor

Description

This PR allows identifying and passing the guest OS for VMware VMs to be migrated to KVM

  • The guestOsIdenfier is retrieved from the source VM along with the host hypervisor version
  • CloudStack checks existing guest OS mappings for VMware matching the hypervisor version and the OS identifier
    • If no entries are retrieved: then the guest OS of the default import template will be used
    • If entries are retrieved: a list of matching guest OS mappings are displayed for users to select one.
Screenshot 2026-03-12 at 2 45 26 PM

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 14.11765% with 73 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.60%. Comparing base (e93ae1a) to head (d9928c5).

Files with missing lines Patch % Lines
...in/java/com/cloud/hypervisor/vmware/mo/BaseMO.java 7.14% 13 Missing ⚠️
...dstack/api/response/UnmanagedInstanceResponse.java 0.00% 12 Missing ⚠️
.../org/apache/cloudstack/vm/UnmanagedInstanceTO.java 16.66% 10 Missing ⚠️
...src/main/java/com/cloud/api/ApiResponseHelper.java 0.00% 6 Missing and 3 partials ⚠️
.../apache/cloudstack/vm/UnmanagedVMsManagerImpl.java 10.00% 6 Missing and 3 partials ⚠️
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 0.00% 4 Missing ⚠️
...e/cloudstack/api/command/admin/vm/ImportVmCmd.java 0.00% 3 Missing ⚠️
...udstack/api/command/user/guest/ListGuestOsCmd.java 0.00% 3 Missing ⚠️
...ain/java/com/cloud/storage/dao/GuestOSDaoImpl.java 0.00% 3 Missing ⚠️
...in/java/com/cloud/server/ManagementServerImpl.java 0.00% 2 Missing and 1 partial ⚠️
... and 3 more
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #12802      +/-   ##
============================================
- Coverage     17.61%   17.60%   -0.01%     
  Complexity    15661    15661              
============================================
  Files          5917     5917              
  Lines        531430   531513      +83     
  Branches      64973    64986      +13     
============================================
- Hits          93586    93579       -7     
- Misses       427288   427374      +86     
- Partials      10556    10560       +4     
Flag Coverage Δ
uitests 3.70% <ø> (-0.01%) ⬇️
unittests 18.67% <14.11%> (-0.01%) ⬇️

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.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17120

@nvazquez
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-15637)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 59357 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12802-t15637-kvm-ol8.zip
Smoke tests completed. 146 look OK, 3 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
ContextSuite context=TestListIdsParams>:teardown Error 1.17 test_list_ids_parameter.py
test_01_snapshot_root_disk Error 5.04 test_snapshots.py
test_02_list_snapshots_with_removed_data_store Error 49.59 test_snapshots.py
test_02_list_snapshots_with_removed_data_store Error 49.60 test_snapshots.py
ContextSuite context=TestSnapshotStandaloneBackup>:teardown Error 32.77 test_snapshots.py
test_01_snapshot_usage Error 29.00 test_usage.py
test_01_vpn_usage Error 1.10 test_usage.py

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

clgtm

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17136

@DaanHoogland
Copy link
Contributor

@blueorangutan test ol9 vmware-82u3

@blueorangutan
Copy link

@DaanHoogland [SL] unsupported parameters provided. Supported mgmt server os are: suse15, alma10, ol10, rocky10, alma9, centos7, centos6, rocky9, alma8, ubuntu18, ol9, ol8, ubuntu22, debian12, ubuntu20, rocky8, ubuntu24. Supported hypervisors are: 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

@DaanHoogland
Copy link
Contributor

@blueorangutan test ol9 vmware-80u3

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol9 mgmt + vmware-80u3) has been kicked to run smoke tests

@rajujith
Copy link

@nvazquez

Error in importing

2026-03-17 04:18:46,510 ERROR [c.c.a.ApiServer] (qtp1513608173-368:[ctx-97245118, ctx-bbd84f7a]) (logid:bd327073) unhandled exception executing api command: [Ljava.lang.String;@10db9cad java.lang.NullPointerException: Cannot invoke "org.apache.cloudstack.api.EntityReference.value()" because the return value of "java.lang.Class.getAnnotation(java.lang.Class)" is null
        at com.cloud.api.dispatch.ParamProcessWorker.translateUuidToInternalId(ParamProcessWorker.java:522)
        at com.cloud.api.dispatch.ParamProcessWorker.setFieldValue(ParamProcessWorker.java:433)
        at com.cloud.api.dispatch.ParamProcessWorker.processParameters(ParamProcessWorker.java:208)
        at com.cloud.api.dispatch.ParamProcessWorker.handle(ParamProcessWorker.java:90)
        at com.cloud.api.dispatch.DispatchChain.dispatch(DispatchChain.java:37)
        at com.cloud.api.ApiServer.queueCommand(ApiServer.java:806)

@blueorangutan
Copy link

[SF] Trillian test result (tid-15664)
Environment: vmware-80u3 (x2), zone: Advanced Networking with Mgmt server ol9
Total time taken: 85447 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12802-t15664-vmware-80u3.zip
Smoke tests completed. 146 look OK, 3 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_list_vms_metrics_admin Error 3620.72 test_metrics_api.py
test_list_vms_metrics_history Error 3627.84 test_metrics_api.py
test_list_volumes_metrics_history Error 3620.84 test_metrics_api.py
test_01_vpn_usage Error 1.08 test_usage.py
test_01_create_volume Failure 1358.62 test_volumes.py

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17177

Comment on lines 351 to 369
if (host != null) {
response.setHostId(host.getUuid());
response.setHostName(host.getName());
if (host.getHypervisorType() != null) {
response.setHypervisor(host.getHypervisorType().toString());
}
response.setHypervisorVersion(host.getHypervisorVersion());
} else {
// In case the unmanaged instance is on an external host
if (instance.getHostName() != null) {
response.setHostName(instance.getHostName());
}
if (instance.getHostHypervisorVersion() != null) {
response.setHypervisorVersion(instance.getHostHypervisorVersion());
}
if (instance.getHypervisorType() != null) {
response.setHypervisor(instance.getHypervisorType());
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

new method, willbe usable in ApiResponseHelperL5342 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

5 participants