Skip to content

Guest OS rules - #10098

Merged
winterhazel merged 7 commits into
apache:mainfrom
scclouds:guest-os-rules
Jun 15, 2026
Merged

Guest OS rules#10098
winterhazel merged 7 commits into
apache:mainfrom
scclouds:guest-os-rules

Conversation

@BryanMLima

@BryanMLimaBryanMLima commented Dec 12, 2024

Copy link
Copy Markdown
Contributor

Description

Currently, ACS provides a feature that enables a guest OS preference for a specific host, prioritizing VMs based on its OS. However, this functionality allows VMs with different OSes to be deployed in a host with a Guest OS defined, as expected as it is only a preference configuration; this is not always desired. For example, keeping proprietary OS in the same host could reduce licensing costs.

This PR tackles this scenario, allowing JavaScript rules, using the JS interpreter introduced in #5909, to direct VMs to specific hosts based on their OS. Different from the guest OS preference, these guest OS rules will be strict. This new feature added a new field, Guest OS as JS rule in the host edit view to allow users the creation of these rules.

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

Screenshots (if appropriate):

image

How Has This Been Tested?

In a local lab with two hosts (host-1 and host-2) I created the guest OS rule vmGuestOs.toLowerCase().indexOf("debian") != -1 for host-2, and deployed multiple VMs using templates and ISOs.

  • I deployed VMs with Ubuntu and CentOS and verify that host-2 was filtered during the deployment.
  • I tried to migrate these VMs to host-2 and verified that it was not possible.
  • I deployed a Debian VM and verified that both hosts were considered in the deployment process.
  • I managed to migrate this VM from host-1 to host-2 and vice versa.

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

I tried to deploy VMs in the same lab without the guest OS rules defined and validated that the deployment of VMs were being done as expected.

@codecov

codecovBot commented Dec 12, 2024

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 12.94118% with 148 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.75%. Comparing base (6bc83a3) to head (f739fd4).
⚠️ Report is 3 commits behind head on main.

Files with missing linesPatch %Lines
...n/java/com/cloud/resource/ResourceManagerImpl.java0.00%43 Missing ⚠️
...om/cloud/deploy/DeploymentPlanningManagerImpl.java0.00%26 Missing ⚠️
.../src/main/java/com/cloud/host/dao/HostDaoImpl.java0.00%21 Missing and 1 partial ⚠️
...udstack/utils/jsinterpreter/GenericRuleHelper.java30.43%15 Missing and 1 partial ⚠️
...ud/agent/manager/allocator/impl/BaseAllocator.java0.00%14 Missing ⚠️
server/src/main/java/com/cloud/api/ApiDBUtils.java0.00%7 Missing ⚠️
...g/apache/cloudstack/api/response/HostResponse.java0.00%6 Missing ⚠️
.../cloud/configuration/ConfigurationManagerImpl.java0.00%3 Missing and 1 partial ⚠️
...oudstack/api/command/admin/host/UpdateHostCmd.java0.00%3 Missing ⚠️
...c/main/java/com/cloud/api/query/vo/HostJoinVO.java0.00%3 Missing ⚠️
... and 3 more
Additional details and impacted files
@@ Coverage Diff @@## main #10098 +/- ##
============================================
- Coverage 18.75% 18.75% -0.01% 
Complexity 17966 17966 ============================================
Files 6160 6161 +1 Lines 552578 552699 +121 Branches 67348 67368 +20 ============================================
- Hits 103660 103639 -21 - Misses 437512 437656 +144 + Partials 11406 11404 -2 
FlagCoverage Δ
uitests3.53% <ø> (-0.01%)⬇️
unittests19.94% <12.94%> (-0.01%)⬇️

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

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@sureshanaparti

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@sureshanaparti 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
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

@DaanHoogland

Copy link
Copy Markdown
Contributor

@BryanMLima can you look at the conflicts?

@BryanMLima

Copy link
Copy Markdown
ContributorAuthor

@BryanMLima can you look at the conflicts?

I will take a look this week, apologies for disappearing 😅 .

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@winterhazel

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@winterhazel 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.

@blueorangutan

Copy link
Copy Markdown

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

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@hsato03
hsato03 self-requested a review June 8, 2026 12:54
Comment threadserver/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java Outdated
Comment threadui/public/locales/pt_BR.json
@winterhazel

Copy link
Copy Markdown
Member

@blueorangutan package

@hsato03hsato03 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CLGTM

@winterhazel

Copy link
Copy Markdown
Member

@DaanHoogland@weizhouapache@sureshanaparti can we run the CI here one last time?

@winterhazel

Copy link
Copy Markdown
Member

@Pearl1594 can we run the CI here? Thanks.

@Pearl1594

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

TestResultTime (s)Test File

@winterhazel
winterhazel merged commit 2081ac4 into apache:mainJun 15, 2026
25 of 27 checks passed
Sign up for freeto 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.

10 participants

@BryanMLima@sureshanaparti@blueorangutan@DaanHoogland@rajujith@winterhazel@Pearl1594@hsato03@harikrishna-patnala@weizhouapache