Skip to content

Service offering category feature#12144

Open
Hanarion wants to merge 20 commits into
apache:mainfrom
Hanarion:service_offering_category_feature
Open

Service offering category feature#12144
Hanarion wants to merge 20 commits into
apache:mainfrom
Hanarion:service_offering_category_feature

Conversation

@Hanarion
Copy link
Copy Markdown

Description

When using Cloudstack, when creating instance with a lot of offerings, it could be hard to differentiate between all of the offerings. For that, categories could be useful.

This pull request introduces the concept of "Service Offering Categories" to the API, allowing service offerings to be grouped, managed, and queried by category. It adds a new interface for categories, updates the API to support creating, updating, deleting, and listing categories, and enables associating service offerings with a category. The changes also extend existing API commands and responses to work with categories.

Service Offering Category API Support:

  • Added new API commands for service offering categories: CreateServiceOfferingCategoryCmd, DeleteServiceOfferingCategoryCmd, UpdateServiceOfferingCategoryCmd, and ListServiceOfferingCategoriesCmd, enabling full CRUD operations and listing for categories.
  • Updated ConfigurationService interface to include methods for creating, deleting, and updating service offering categories.
  • Added a new interface ServiceOfferingCategory that defines category properties and behaviors.

API Parameter and Response Enhancements:

  • Introduced new API parameters and constants for category ID and name (SERVICE_OFFERING_CATEGORY_ID, SERVICE_OFFERING_CATEGORY_NAME) in ApiConstants, and updated related commands (CreateServiceOfferingCmd, UpdateServiceOfferingCmd, ListServiceOfferingsCmd) to accept or filter by category.
  • Extended ResponseGenerator to support generating responses for service offering categories.

Service Offering Model Update:

  • Added a getCategoryId() method to the ServiceOffering interface, allowing offerings to be associated with a specific category.

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):

image image image image

How Has This Been Tested?

On my dev environment, through the API and cloudmonkey

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

Those changes should not break any features as it is only adding a new column to serviceoffering and adding a new table, it is only a way to filter and categorize.

--
I'm sorry if the formatting isn't perfect, i couldn't get the pre-commit to work, and it is my first code PR.
Warning, i put the SQL where i thought it made sense, but i think you will want to move it where it really should be.

Landry JUGE added 5 commits November 26, 2025 19:23
- Introduced new API commands for creating, updating, and deleting service offering categories.
- Added support for associating service offerings with categories.
- Updated database schema to include service offering categories.
- Enhanced existing service offering commands to handle category IDs.
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 2.26415% with 259 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.01%. Comparing base (b744824) to head (716d823).

Files with missing lines Patch % Lines
.../cloud/configuration/ConfigurationManagerImpl.java 4.91% 57 Missing and 1 partial ⚠️
...a/com/cloud/service/ServiceOfferingCategoryVO.java 0.00% 37 Missing ⚠️
...ain/java/com/cloud/api/query/QueryManagerImpl.java 0.00% 30 Missing ⚠️
...min/offering/UpdateServiceOfferingCategoryCmd.java 0.00% 22 Missing ⚠️
...min/offering/CreateServiceOfferingCategoryCmd.java 0.00% 19 Missing ⚠️
.../api/response/ServiceOfferingCategoryResponse.java 0.00% 19 Missing ⚠️
...min/offering/DeleteServiceOfferingCategoryCmd.java 0.00% 15 Missing ⚠️
...ud/service/dao/ServiceOfferingCategoryDaoImpl.java 0.00% 14 Missing ⚠️
...min/offering/ListServiceOfferingCategoriesCmd.java 0.00% 12 Missing ⚠️
...src/main/java/com/cloud/api/ApiResponseHelper.java 0.00% 8 Missing ⚠️
... and 8 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12144      +/-   ##
============================================
- Coverage     18.02%   18.01%   -0.01%     
  Complexity    16450    16450              
============================================
  Files          5968     5975       +7     
  Lines        537086   537388     +302     
  Branches      65961    65995      +34     
============================================
+ Hits          96819    96823       +4     
- Misses       429347   429644     +297     
- Partials      10920    10921       +1     
Flag Coverage Δ
uitests 3.52% <ø> (-0.01%) ⬇️
unittests 19.18% <2.26%> (-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.

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

@bernardodemarco bernardodemarco self-requested a review November 28, 2025 11:22
@daviftorres
Copy link
Copy Markdown
Contributor

Dear @Hanarion,

This is a nice feature to have. Are you considering extending it to allow a domain or account to be limited to one (or a specific list) of categories?

For example, we distinguish between Core (higher-performance hardware) and Essentials (lower-performance hardware), in a tiered fashion (with different costs, of course). With "Offering Category", we could define which groups of offerings a client (domain/account) is allowed to use.

What do you think?

@Hanarion
Copy link
Copy Markdown
Author

@daviftorres it could be interesting yes.
An association between accounts, domains and the categories ? And if none are found, we show everything ?
But that would mean that we would need to add a check for "permission" to use the specific service offering category when creating a VM if we want to do things right.
What do you think ?

@daviftorres
Copy link
Copy Markdown
Contributor

@daviftorres it could be interesting yes. An association between accounts, domains and the categories ? And if none are found, we show everything ? But that would mean that we would need to add a check for "permission" to use the specific service offering category when creating a VM if we want to do things right. What do you think ?

Sounds great!

@rajujith
Copy link
Copy Markdown
Contributor

rajujith commented Dec 1, 2025

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@rajujith 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 15873

Copy link
Copy Markdown
Contributor

@rajujith rajujith left a comment

Choose a reason for hiding this comment

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

@Hanarion I added service offering to a new category but it gets added the default one although the API has the correct one.

@Hanarion
Copy link
Copy Markdown
Author

Hanarion commented Dec 2, 2025

@rajujith thanks for the review.
Can you give me a bit more detail about that ? Is it showing the default one in the list UI, detail or edit ?
Or do you mean that the return object isn't updated with the new category on the edit service offering call ?

I'll check today in order to fix this issue

@rajujith
Copy link
Copy Markdown
Contributor

rajujith commented Dec 3, 2025

@Hanarion

Screen.Recording.2025-12-03.at.10.03.17.AM.mov

Landry JUGE added 2 commits December 3, 2025 14:56
AND `lease_expiry_action_details`.`name` = 'leaseexpiryaction'
GROUP BY
`service_offering`.`id`;
`service_offering`.`id`; No newline at end of file
Copy link
Copy Markdown
Contributor

@DaanHoogland DaanHoogland Dec 8, 2025

Choose a reason for hiding this comment

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

another eof lint error

@DaanHoogland
Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

@DaanHoogland 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-14913)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 58122 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12144-t14913-kvm-ol8.zip
Smoke tests completed. 145 look OK, 5 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_updating_nics_on_two_shared_networks Error 1.80 test_gateway_on_shared_networks.py
ContextSuite context=TestGatewayOnSharedNetwork>:teardown Error 4.04 test_gateway_on_shared_networks.py
test_11_destroy_ssvm Error 3.23 test_ssvm.py
test_01_vpn_usage Error 1.12 test_usage.py
test_01_secure_vm_migration Error 135.45 test_vm_life_cycle.py
test_01_secure_vm_migration Error 135.46 test_vm_life_cycle.py
test_hostha_enable_ha_when_host_disabled Error 3.92 test_hostha_kvm.py
test_hostha_enable_ha_when_host_in_maintenance Error 306.19 test_hostha_kvm.py

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

@DaanHoogland
Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@DaanHoogland 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 ✔️ debian ✖️ suse15. SL-JID 16443

@DaanHoogland
Copy link
Copy Markdown
Contributor

@DaanHoogland
Copy link
Copy Markdown
Contributor

the el compile gives

10:26:59 [INFO] Running org.apache.cloudstack.maintenance.ManagementServerMaintenanceManagerImplTest
10:27:03 [ERROR] Tests run: 34, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.786 s <<< FAILURE! - in org.apache.cloudstack.maintenance.ManagementServerMaintenanceManagerImplTest
10:27:03 [ERROR] unnecessary Mockito stubbings(org.apache.cloudstack.maintenance.ManagementServerMaintenanceManagerImplTest)  Time elapsed: 0.03 s  <<< ERROR!
10:27:03 org.mockito.exceptions.misusing.UnnecessaryStubbingException: 
10:27:03 
10:27:03 Unnecessary stubbings detected in test class: ManagementServerMaintenanceManagerImplTest
10:27:03 Clean & maintainable test code requires zero unnecessary code.
10:27:03 Following stubbings are unnecessary (click to navigate to relevant line of code):
10:27:03   1. -> at org.apache.cloudstack.maintenance.ManagementServerMaintenanceManagerImplTest.prepareForMaintenanceAndCancelFromMaintenanceState(ManagementServerMaintenanceManagerImplTest.java:324)
10:27:03   2. -> at org.apache.cloudstack.maintenance.ManagementServerMaintenanceManagerImplTest.prepareForMaintenanceAndCancelFromPreparingForMaintenanceState(ManagementServerMaintenanceManagerImplTest.java:342)
10:27:03 Please remove unnecessary stubbings or use 'lenient' strictness. More info: javadoc for UnnecessaryStubbingException class.
10:27:03 
10:27:04 [INFO] 
10:27:04 [INFO] Results:
10:27:04 [INFO] 
10:27:04 [ERROR] Errors: 
10:27:04 [ERROR]   ManagementServerMaintenanceManagerImplTest.unnecessary Mockito stubbings ? UnnecessaryStubbing
10:27:04 [INFO] 
10:27:04 [ERROR] Tests run: 34, Failures: 0, Errors: 1, Skipped: 0

This might be due to a injected object no longer being called in a test. It is always an awkward issue to find. Can you help on this one @vishesh92 ?

@vishesh92
Copy link
Copy Markdown
Member

the el compile gives

10:26:59 [INFO] Running org.apache.cloudstack.maintenance.ManagementServerMaintenanceManagerImplTest
10:27:03 [ERROR] Tests run: 34, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.786 s <<< FAILURE! - in org.apache.cloudstack.maintenance.ManagementServerMaintenanceManagerImplTest
10:27:03 [ERROR] unnecessary Mockito stubbings(org.apache.cloudstack.maintenance.ManagementServerMaintenanceManagerImplTest)  Time elapsed: 0.03 s  <<< ERROR!
10:27:03 org.mockito.exceptions.misusing.UnnecessaryStubbingException: 
10:27:03 
10:27:03 Unnecessary stubbings detected in test class: ManagementServerMaintenanceManagerImplTest
10:27:03 Clean & maintainable test code requires zero unnecessary code.
10:27:03 Following stubbings are unnecessary (click to navigate to relevant line of code):
10:27:03   1. -> at org.apache.cloudstack.maintenance.ManagementServerMaintenanceManagerImplTest.prepareForMaintenanceAndCancelFromMaintenanceState(ManagementServerMaintenanceManagerImplTest.java:324)
10:27:03   2. -> at org.apache.cloudstack.maintenance.ManagementServerMaintenanceManagerImplTest.prepareForMaintenanceAndCancelFromPreparingForMaintenanceState(ManagementServerMaintenanceManagerImplTest.java:342)
10:27:03 Please remove unnecessary stubbings or use 'lenient' strictness. More info: javadoc for UnnecessaryStubbingException class.
10:27:03 
10:27:04 [INFO] 
10:27:04 [INFO] Results:
10:27:04 [INFO] 
10:27:04 [ERROR] Errors: 
10:27:04 [ERROR]   ManagementServerMaintenanceManagerImplTest.unnecessary Mockito stubbings ? UnnecessaryStubbing
10:27:04 [INFO] 
10:27:04 [ERROR] Tests run: 34, Failures: 0, Errors: 1, Skipped: 0

This might be due to a injected object no longer being called in a test. It is always an awkward issue to find. Can you help on this one @vishesh92 ?

As per the logs, it just requires removal of mocks in the tests. That is all.

@Hanarion
Copy link
Copy Markdown
Author

@Hanarion , please have a look at https://github.com/apache/cloudstack/actions/runs/21154328270/job/60860521695?pr=12144#step:6:10979

Should be fixed now, sorry for that, i had issues when running pre-commit so missed thoses

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

@DaanHoogland
Copy link
Copy Markdown
Contributor

@Hanarion , sorry to say that more conflicts will happen over the coming period. Can you have a look again?

@Hanarion
Copy link
Copy Markdown
Author

I'll check tomorrow, seems like there was refactoring to move the form to a ComputeOfferingForm component, i'll move my changes over there and re-test

…tegory_feature

# Conflicts:
#	ui/src/views/offering/AddComputeOffering.vue
@Hanarion
Copy link
Copy Markdown
Author

Hanarion commented Mar 18, 2026

I have not yet tested the merge yet, I can't start the build process anymore, i'm checking my setup

@Hanarion
Copy link
Copy Markdown
Author

After a few fixes it is now merged and implemented successfully in the clone compute offering that was merged a few days ago

@weizhouapache weizhouapache added this to the 4.23.0 milestone May 7, 2026
@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 18019

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.

9 participants