Service offering category feature
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, andListServiceOfferingCategoriesCmd, enabling full CRUD operations and listing for categories. - Updated
ConfigurationServiceinterface to include methods for creating, deleting, and updating service offering categories. - Added a new interface
ServiceOfferingCategorythat 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) inApiConstants, and updated related commands (CreateServiceOfferingCmd,UpdateServiceOfferingCmd,ListServiceOfferingsCmd) to accept or filter by category. - Extended
ResponseGeneratorto support generating responses for service offering categories.
Service Offering Model Update:
- Added a
getCategoryId()method to theServiceOfferinginterface, allowing offerings to be associated with a specific category.
Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [X] 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
- [X] Major
- [ ] Minor
Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [ ] Minor
- [ ] Trivial
Screenshots (if appropriate):
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.
Codecov Report
:x: Patch coverage is 0.37879% with 263 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 17.56%. Comparing base (2600965) to head (4ff6cf3).
Additional details and impacted files
@@ Coverage Diff @@
## main #12144 +/- ##
============================================
- Coverage 17.57% 17.56% -0.01%
+ Complexity 15550 15549 -1
============================================
Files 5913 5920 +7
Lines 529427 529717 +290
Branches 64677 64708 +31
============================================
- Hits 93024 93023 -1
- Misses 425940 426232 +292
+ Partials 10463 10462 -1
| Flag | Coverage Δ | |
|---|---|---|
| uitests | 3.58% <ø> (-0.01%) |
:arrow_down: |
| unittests | 18.62% <0.37%> (-0.02%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
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?
@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 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!
@blueorangutan package
@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.
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15873
@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
@Hanarion
https://github.com/user-attachments/assets/53355d0d-9afb-4e0a-a826-11e0fac9a485
@rajujith Indeed when refactoring the names of the fields before comitting, i broke the functionnality, i fixed it.
Also, i dont know where i should put the SQL, currently i put it in schema-42200to42300.sql, but I think it should be moved to schema-42210to42300.sql
Do you confirm ?
@rajujith Indeed when refactoring the names of the fields before comitting, i broke the functionnality, i fixed it.
Also, i dont know where i should put the SQL, currently i put it in schema-42200to42300.sql, but I think it should be moved to schema-42210to42300.sql
Do you confirm ?
Thanks for fixing it @Hanarion , regarding the schema lets ask a dev @DaanHoogland @harikrishna-patnala
@blueorangutan package
@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.
Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 15912
@rajujith Indeed when refactoring the names of the fields before comitting, i broke the functionnality, i fixed it.
Also, i dont know where i should put the SQL, currently i put it in schema-42200to42300.sql, but I think it should be moved to schema-42210to42300.sql
Do you confirm ?
Thanks for fixing it @Hanarion , regarding the schema lets ask a dev @DaanHoogland @harikrishna-patnala
Yes @Hanarion , 42210 to 42300 seems appropriate.
@blueorangutan package
@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.
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15925
@blueorangutan test
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests
[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 |