Skip to content

Conversation

shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Sep 6, 2025

Description

Currently, some APIs return domainpath as 'ROOT/domain1/domain2' while other return it as '/domain1/domain2'. This PR makes the response consistent.

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?

Before:

(localcloud) 🐱 > list networks listall=true filter=id,name,domainpath
{
  "count": 2,
  "network": [
    {
      "domainpath": "/d1/d11/",
      "id": "5f58ee16-9140-4241-a50f-3c079b9717e1",
      "name": "d11user-network"
    },
    {
      "domainpath": "/",
      "id": "67c1bb61-1155-4b49-9288-543abd95e7ce",
      "name": "abc"
    }
  ]
}
(localcloud) 🐱 > list accounts listall=true filter=id,name,domainpath
{
  "account": [
    {
      "domainpath": "ROOT",
      "id": "b1962584-8a72-11f0-8f55-a02942fcdd70",
      "name": "admin"
    },
    {
      "domainpath": "ROOT",
      "id": "0b56a8ae-5b2d-4b15-ae7d-2a7209e25d18",
      "name": "baremetal-system-account"
    },
    {
      "domainpath": "ROOT/d1/d11",
      "id": "0a5340ac-4e5c-4cc2-9c1c-dd00014e36b5",
      "name": "d11user"
    }
  ],
  "count": 3
}

After:

(localcloud) 🐱 > list networks listall=true filter=id,name,domainpath
{
  "count": 2,
  "network": [
    {
      "domainpath": "ROOT/d1/d11",
      "id": "5f58ee16-9140-4241-a50f-3c079b9717e1",
      "name": "d11user-network"
    },
    {
      "domainpath": "ROOT",
      "id": "67c1bb61-1155-4b49-9288-543abd95e7ce",
      "name": "abc"
    }
  ]
}
(localcloud) 🐱 > list accounts listall=true filter=id,name,domainpath
{
  "account": [
    {
      "domainpath": "ROOT",
      "id": "b1962584-8a72-11f0-8f55-a02942fcdd70",
      "name": "admin"
    },
    {
      "domainpath": "ROOT",
      "id": "0b56a8ae-5b2d-4b15-ae7d-2a7209e25d18",
      "name": "baremetal-system-account"
    },
    {
      "domainpath": "ROOT/d1/d11",
      "id": "0a5340ac-4e5c-4cc2-9c1c-dd00014e36b5",
      "name": "d11user"
    }
  ],
  "count": 3
}

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

Currently, some APIs return domainpath as 'ROOT/domain1/domain2' while
other return it as '/domain1/domain2'. This PR makes the response
consistent.

Signed-off-by: Abhishek Kumar <[email protected]>
Copy link

codecov bot commented Sep 6, 2025

Codecov Report

❌ Patch coverage is 30.76923% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.36%. Comparing base (3ddd802) to head (eaff6f0).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...src/main/java/com/cloud/api/ApiResponseHelper.java 40.00% 5 Missing and 1 partial ⚠️
...va/com/cloud/api/query/dao/AccountJoinDaoImpl.java 0.00% 1 Missing ⚠️
...a/com/cloud/api/query/dao/AsyncJobJoinDaoImpl.java 0.00% 1 Missing ⚠️
...ava/com/cloud/api/query/dao/DomainJoinDaoImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #11589      +/-   ##
============================================
- Coverage     17.36%   17.36%   -0.01%     
- Complexity    15235    15237       +2     
============================================
  Files          5888     5888              
  Lines        525740   525738       -2     
  Branches      64164    64164              
============================================
- Hits          91272    91270       -2     
+ Misses       424168   424167       -1     
- Partials      10300    10301       +1     
Flag Coverage Δ
uitests 3.63% <ø> (ø)
unittests 18.40% <30.76%> (-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.

@shwstppr
Copy link
Contributor Author

shwstppr commented Sep 6, 2025

@blueorangutan package

@blueorangutan
Copy link

@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

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

Copy link
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.

my preference would be to remove the word ‘ROOT’ but CLGTM (also potaeto/potahto)

@@ -3049,7 +3053,7 @@ private void populateOwner(ControlledEntityResponse response, ControlledEntity o
Domain domain = ApiDBUtils.findDomainById(object.getDomainId());
response.setDomainId(domain.getUuid());
response.setDomainName(domain.getName());
response.setDomainPath(domain.getPath());
response.setDomainPath(getPrettyDomainPath(domain.getPath()));
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we keep the same in the next methods or are these covered some how populateOwner(ControlledViewEntityResponse response, ControlledEntity object)
populateDomain(ControlledEntityResponse response, long domainId)
createUsageResponse(Usage usageRecord, Map<String, Set> resourceTagResponseMap, boolean oldFormat)
createAffinityGroupResponse(AffinityGroup group)
populateDomainFieldsOnConsoleSessionResponse()
createVMSnapshotResponse()
?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

4 participants