Skip to content

Fix listing service offerings with different host tags#12919

Open
nvazquez wants to merge 3 commits intoapache:4.22from
shapeblue:422-change-offering-hosttags
Open

Fix listing service offerings with different host tags#12919
nvazquez wants to merge 3 commits intoapache:4.22from
shapeblue:422-change-offering-hosttags

Conversation

@nvazquez
Copy link
Copy Markdown
Contributor

Description

This PR fixes the listing of service offerings for VMs, including offerings that contain different host tags. Previously only offerings without any host tag or offerings matching exactly the same VM offering host tags were displayed

Fixes: #11407

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?

  • Create service offering A with host tag = TAG_A
  • Create service offering B with host tag = TAG_B
  • Edit hosts, some using tag TAG_A and some using TAG_B
  • Deploy VM from service offering A
  • Stop VM
  • Click on Scale VM, observe that offering B is available, select offering B
  • VM is properly scaled to use offering B

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

@nvazquez
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

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

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 45.45455% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.60%. Comparing base (59b6c32) to head (deeac92).

Files with missing lines Patch % Lines
...ain/java/com/cloud/api/query/QueryManagerImpl.java 52.38% 6 Missing and 4 partials ⚠️
.../main/java/com/cloud/host/dao/HostTagsDaoImpl.java 33.33% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #12919      +/-   ##
============================================
- Coverage     17.60%   17.60%   -0.01%     
- Complexity    15676    15678       +2     
============================================
  Files          5918     5918              
  Lines        531667   531699      +32     
  Branches      65001    65006       +5     
============================================
+ Hits          93617    93619       +2     
- Misses       427491   427515      +24     
- Partials      10559    10565       +6     
Flag Coverage Δ
uitests 3.70% <ø> (ø)
unittests 18.67% <45.45%> (-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
Copy Markdown

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates service offering listing logic (used for VM scaling) so that offerings with different host tags are also shown, by expanding the tag filter to include tags present on hosts in the VM’s current cluster and by loosening host-tag matching to OR semantics.

Changes:

  • Extend service offering filtering to include host tags from the VM’s current cluster when listing scale-eligible offerings.
  • Change host-tag matching from requiring all tags (AND) to allowing any matching tag (OR), while still including untagged offerings.
  • Add unit tests for collecting cluster host tags into the VM’s host tag filter.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java Expands host-tag filtering for service offering listing and adds helper to include cluster tags.
engine/schema/src/main/java/com/cloud/host/dao/HostTagsDao.java Adds DAO API to list host tags by cluster ID.
engine/schema/src/main/java/com/cloud/host/dao/HostTagsDaoImpl.java Implements listing tags by cluster via host IDs + custom search.
server/src/test/java/com/cloud/api/query/QueryManagerImplTest.java Adds tests for the new helper that augments host tags with current cluster tags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nvazquez
Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

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

@nvazquez nvazquez added this to the 4.22.1 milestone Mar 31, 2026
@nvazquez
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

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

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

Copy link
Copy Markdown
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

Copy link
Copy Markdown
Contributor

@Pearl1594 Pearl1594 left a comment

Choose a reason for hiding this comment

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

I was wondering if it would make sense to guard this under a global setting like vm.scale.allow.differing.host.tags, which by default would be false, to keep the existing behaviour. The reason being, with this PR it definitely gives flexibility to scale to an offering with different host tags, but end users may not be able to tell from the list which offerings would actually work for them. For example, if a user's VM is currently on a GPU host and they want to scale up for more resources, they may see SSD offerings in the list (because the cluster has SSD hosts as well), but depending on whether their specific host has both GPU and SSD tags or just GPU, the scale operation may succeed or fail with a "host tags" error. A global setting would allow users to opt into this new behaviour while keeping the current behaviour as the default.

@blueorangutan
Copy link
Copy Markdown

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

Test Result Time (s) Test File
test_01_redundant_vpc_site2site_vpn Failure 396.08 test_vpc_vpn.py

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.

Ability to change compute offering with different host tags

5 participants