Skip to content

framework,api,server,ui: improve error messaging - #12336

Draft
shwstppr wants to merge 15 commits into
apache:4.22from
shapeblue:improve-error-messages
Draft

shwstppr wants to merge 15 commits into
apache:4.22from
shapeblue:improve-error-messages

Conversation

@shwstppr

@shwstppr shwstppr commented Dec 24, 2025 •

Copy link
Copy Markdown
Contributor

Description

Framework-level improvements for contextual and localized API error messages

Design spec: Error Message Consistency, Customization, and Localization Framework

Documentation PR: apache/cloudstack-documentation#684

Developed focused documentation is also added at api/src/main/java/org/apache/cloudstack/error/README.md

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

Refined error message with additional context for admin
image

User facing error, with localization
image

Example API response

{
    "deployvirtualmachineresponse": {
        "uuidList": [],
        "errorcode": 535,
        "cserrorcode": 9999,
        "errortext": "Unable to deploy Instance because allocating 1 more Instance would exceed the Account limits. Current: 2, Reserved: 0, Limit: 2. Release unused resources, then retry.",
        "errortextkey": "vm.deploy.resourcelimit.exceeded.account",
        "errormetadata": {
            "resourceRequested": "1",
            "resourceTypeDisplay": "Instance",
            "resourceOwnerType": "Account",
            "resourceAmount": "2",
            "resourceReserved": "0",
            "resourceLimit": "2"
        }
    }
}

How Has This Been Tested?

End-to-end testing and the following smoke test,

[root@qa1-improve-err-88bf966b-kvm-mgmt1 marvin]# nosetests --with-xunit --xunit-file=results.xml --with-marvin --marvin-config=./marvin.cfg -s -a tags=advanced --hypervisor=KVM tests/smoke/test_error_message_framework.py 
/usr/local/lib/python3.6/site-packages/paramiko/transport.py:32: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
  from cryptography.hazmat.backends import default_backend

==== Marvin Init Started ====

=== Marvin Parse Config Successful ===

=== Marvin Setting TestData Successful===

==== Log Folder Path: /tmp/MarvinLogs/Sep_18_2026_04_59_46_OYCP7L All logs will be available here ====

=== Marvin Init Logging Successful===

==== Marvin Init Successful ====
=== TestName: test_01_runtime_error_message_override_for_regular_user | Status : SUCCESS ===

=== TestName: test_02_runtime_error_message_override_for_admin | Status : SUCCESS ===

=== Final results are now copied to: /tmp//MarvinLogs/test_error_message_framework_DBR9CT ===

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

@codecov

codecov Bot commented Dec 24, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.72492% with 218 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.08%. Comparing base (2e63c60) to head (f6fc9ad).

Files with missing lines Patch % Lines
...n/java/com/cloud/vm/VirtualMachineManagerImpl.java 11.72% 128 Missing ⚠️
...n/java/org/apache/cloudstack/error/Exceptions.java 50.68% 34 Missing and 2 partials ⚠️
...he/cloudstack/context/ResponseMessageResolver.java 86.58% 17 Missing and 16 partials ⚠️
...udstack/engine/cloud/entity/api/db/VMEntityVO.java 0.00% 4 Missing ⚠️
...rc/main/java/com/cloud/configuration/Resource.java 90.90% 2 Missing ⚠️
...loudstack/api/command/user/vm/BaseDeployVMCmd.java 0.00% 2 Missing ⚠️
...ava/org/apache/cloudstack/context/CallContext.java 93.10% 0 Missing and 2 partials ⚠️
...ine/cloud/entity/api/VirtualMachineEntityImpl.java 0.00% 2 Missing ⚠️
...main/java/com/cloud/api/ApiAsyncJobDispatcher.java 60.00% 2 Missing ⚠️
...c/main/java/com/cloud/user/AccountManagerImpl.java 85.71% 1 Missing and 1 partial ⚠️
... and 5 more
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #12336      +/-   ##
============================================
+ Coverage     18.00%   18.08%   +0.07%     
- Complexity    16219    16336     +117     
============================================
  Files          5936     5938       +2     
  Lines        535716   536130     +414     
  Branches      65596    65650      +54     
============================================
+ Hits          96459    96960     +501     
+ Misses       428268   428138     -130     
- Partials      10989    11032      +43     
Flag Coverage Δ
uitests 4.03% <ø> (+<0.01%) ⬆️
unittests 19.16% <64.72%> (+0.08%) ⬆️

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.

@shwstppr
shwstppr force-pushed the improve-error-messages branch from 86379b7 to c938bd1 Compare December 24, 2025 11:55
@shwstppr shwstppr closed this Jan 6, 2026
@shwstppr shwstppr reopened this Jan 6, 2026
@apache apache deleted a comment from blueorangutan Jan 6, 2026
@apache apache deleted a comment from blueorangutan Jan 6, 2026
@apache apache deleted a comment from blueorangutan Jan 6, 2026
@apache apache deleted a comment from blueorangutan Jan 6, 2026
@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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 40 out of 41 changed files in this pull request and generated 3 comments.

Comment thread test/integration/smoke/test_deploy_vm_root_resize.py Outdated
Comment thread api/src/main/java/org/apache/cloudstack/context/CallContext.java
@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.

Framework-level improvements for for contextual and localized API error
messages

Design doc: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Error+Message+Consistency%2C+Customization%2C+and+Localization+Framework

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr

shwstppr commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr 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 19077

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

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr 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 19280

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

very minor comments added @shwstppr , can you please check them.

I've not verified all of the error labels and strings but checked the logic in implementing them. looks good so far. Thank you.

private String errorText = "Command failed due to Internal Server Error";

@SerializedName("errortextkey")
@Param(description = "the key for the text associated with this error", since = "4.24.0")

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.

change the version to 4.22.2 !!

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr

shwstppr commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr 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 19410

@@ -0,0 +1,732 @@
{

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.

Apologies @shwstppr I missed reviewing this file.

Is it possible to group these labels somehow ? may be group them by resources and APIs like we have the APIs here https://cloudstack.apache.org/api/apidocs-4.23/

I'm thinking in terms of ease of use to the admins.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

8 participants