Skip to content

Conversation

@Hanarion
Copy link

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

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 0.37879% with 263 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.55%. Comparing base (4e61ddd) to head (14724b7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../cloud/configuration/ConfigurationManagerImpl.java 0.00% 60 Missing ⚠️
...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     17.56%   17.55%   -0.01%     
+ Complexity    15548    15547       -1     
============================================
  Files          5913     5920       +7     
  Lines        529440   529730     +290     
  Branches      64670    64701      +31     
============================================
+ Hits          93019    93020       +1     
- Misses       425963   426252     +289     
  Partials      10458    10458              
Flag Coverage Δ
uitests 3.58% <ø> (-0.01%) ⬇️
unittests 18.62% <0.37%> (-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

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

rajujith commented Dec 1, 2025

@blueorangutan package

@blueorangutan
Copy link

@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

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

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.

4 participants