Skip to content

Improve VMware import guest OS detection#13269

Open
andrijapanicsb wants to merge 2 commits into
apache:mainfrom
andrijapanicsb:improve-vm-import-guest-os-recognition
Open

Improve VMware import guest OS detection#13269
andrijapanicsb wants to merge 2 commits into
apache:mainfrom
andrijapanicsb:improve-vm-import-guest-os-recognition

Conversation

@andrijapanicsb
Copy link
Copy Markdown
Contributor

@andrijapanicsb andrijapanicsb commented May 28, 2026

Summary

This improves guest OS detection for VMware-to-KVM VM imports.

VMware can expose two different OS signals for a VM: the configured guest OS identifier, such as otherLinux64Guest, and the runtime/display OS name reported by VMware Tools, such as Debian GNU/Linux 11 (64-bit). The configured identifier can be generic, while the runtime OS name is often more accurate.
(this is exactly the case with systemVM (VR or CPVM or SSVM) which I tried to migrate from another ACS/VMware installation from VMware 7.0 U3)

This change updates the import flow to prefer the more specific runtime/display OS name when resolving CloudStack guest OS mappings, while keeping the existing VMware guest OS identifier lookup as the compatibility fallback.

Details

The guest OS lookup now tries:

  1. VMware guest OS mapping by display OS name and source VMware version.
  2. Existing VMware guest OS identifier mapping and source VMware version.
  3. The same two mapping lookups without the VMware version.
  4. A strong CloudStack OS type match by display name.

If none of these produce a match, the existing fallback behavior remains unchanged.

The same resolution is also applied server-side when osid is not explicitly supplied, so API callers and UI-driven imports follow the same guest OS selection behavior.

Benefit

This avoids falling back to the default import template OS when VMware Tools already reports a precise guest OS name. For example, a VM configured in vSphere as Other Linux (64-bit) but reported by VMware Tools as Debian GNU/Linux 11 (64-bit) can now resolve to the correct CloudStack guest OS when a matching OS or mapping exists.

Testing

mvn -pl server -am -Dtest=UnmanagedVMsManagerImplTest -DfailIfNoTests=false "-Dsurefire.failIfNoSpecifiedTests=false" test

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 78.94737% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.12%. Comparing base (c0ce5b4) to head (bbe7804).

Files with missing lines Patch % Lines
.../apache/cloudstack/vm/UnmanagedVMsManagerImpl.java 83.33% 5 Missing and 7 partials ⚠️
...in/java/com/cloud/server/ManagementServerImpl.java 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13269      +/-   ##
============================================
+ Coverage     18.10%   18.12%   +0.01%     
- Complexity    16749    16776      +27     
============================================
  Files          6037     6037              
  Lines        542796   542914     +118     
  Branches      66456    66495      +39     
============================================
+ Hits          98268    98378     +110     
+ Misses       433492   433484       -8     
- Partials      11036    11052      +16     
Flag Coverage Δ
uitests 3.51% <ø> (-0.01%) ⬇️
unittests 19.28% <78.94%> (+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.

Signed-off-by: andrijapanicsb <45762285+andrijapanicsb@users.noreply.github.com>
@andrijapanicsb andrijapanicsb force-pushed the improve-vm-import-guest-os-recognition branch from bb37ba6 to bbe7804 Compare May 28, 2026 03:59
@andrijapanicsb
Copy link
Copy Markdown
Contributor Author

@blueorangutan package kvm

@blueorangutan
Copy link
Copy Markdown

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

@blueorangutan
Copy link
Copy Markdown

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

@andrijapanicsb
Copy link
Copy Markdown
Contributor Author

@blueorangutan test keepEnv

@blueorangutan
Copy link
Copy Markdown

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

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