Skip to content

Conversation

@shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Nov 3, 2025

Description

Fixes #11608

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

How Has This Been Tested?

> list  domains id=e1190923-d037-4464-9b97-ad912a242952
{
  "count": 1,
  "domain": [
    {
      "backupavailable": "Unlimited",
      "backuplimit": "Unlimited",
      "backupstorageavailable": "800",
      "backupstoragelimit": "Unlimited",
      "backupstoragetotal": 0,
      "backuptotal": 0,
      "bucketavailable": "Unlimited",
      "bucketlimit": "Unlimited",
      "buckettotal": 0,
      "cpuavailable": "Unlimited",
      "cpulimit": "Unlimited",
      "cputotal": 0,
      "created": "2025-10-13T13:06:28+0530",
      "gpuavailable": "Unlimited",
      "gpulimit": "Unlimited",
      "gputotal": 0,
      "hasannotations": false,
      "haschild": false,
      "id": "e1190923-d037-4464-9b97-ad912a242952",
      "ipavailable": "Unlimited",
      "iplimit": "Unlimited",
      "iptotal": 0,
      "level": 1,
      "memoryavailable": "Unlimited",
      "memorylimit": "Unlimited",
      "memorytotal": 0,
      "name": "d1",
      "networkavailable": "Unlimited",
      "networklimit": "Unlimited",
      "networktotal": 1,
      "objectstorageavailable": "Unlimited",
      "objectstoragelimit": "Unlimited",
      "objectstoragetotal": 0,
      "parentdomainid": "27c065d7-a514-11f0-ade4-a02942fcdd70",
      "parentdomainname": "ROOT",
      "path": "ROOT/d1",
      "primarystorageavailable": "Unlimited",
      "primarystoragelimit": "Unlimited",
      "primarystoragetotal": 0,
      "projectavailable": "Unlimited",
      "projectlimit": "Unlimited",
      "projecttotal": 0,
      "secondarystorageavailable": "Unlimited",
      "secondarystoragelimit": "Unlimited",
      "secondarystoragetotal": 0,
      "snapshotavailable": "Unlimited",
      "snapshotlimit": "Unlimited",
      "snapshottotal": 0,
      "state": "Active",
      "tags": [
        {
          "key": "abc",
          "value": "xyz"
        }
      ],
      "templateavailable": "Unlimited",
      "templatelimit": "Unlimited",
      "templatetotal": 0,
      "vmavailable": "Unlimited",
      "vmlimit": "Unlimited",
      "vmtotal": 0,
      "volumeavailable": "Unlimited",
      "volumelimit": "Unlimited",
      "volumetotal": 0,
      "vpcavailable": "Unlimited",
      "vpclimit": "Unlimited",
      "vpctotal": 0
    }
  ]
}

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

Fixes apache#11608

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 4.76190% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.56%. Comparing base (bfc4f60) to head (d94ad99).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...src/main/java/com/cloud/api/ApiResponseHelper.java 0.00% 8 Missing ⚠️
...ava/com/cloud/api/query/dao/DomainJoinDaoImpl.java 0.00% 8 Missing ⚠️
...apache/cloudstack/api/response/DomainResponse.java 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #11964      +/-   ##
============================================
- Coverage     17.56%   17.56%   -0.01%     
  Complexity    15540    15540              
============================================
  Files          5909     5909              
  Lines        529045   529075      +30     
  Branches      64615    64621       +6     
============================================
+ Hits          92933    92938       +5     
- Misses       425657   425683      +26     
+ Partials      10455    10454       -1     
Flag Coverage Δ
uitests 3.58% <ø> (ø)
unittests 18.63% <4.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 shwstppr requested a review from Copilot November 4, 2025 04:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds tag support for Domain resources in Apache CloudStack. The changes enable domains to have resource tags attached, similar to other CloudStack resources like VMs, networks, and projects.

Key Changes

  • Enabled resource tagging support for Domain entities by updating the ResourceObjectType configuration
  • Modified DomainResponse to extend BaseResponseWithTagInformation and populate tags in the API response
  • Updated the UI to include Domain in the list of resources that support tags

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
api/src/main/java/com/cloud/server/ResourceTag.java Enabled resource tags support for Domain entities by changing the first parameter from false to true
api/src/main/java/org/apache/cloudstack/api/response/DomainResponse.java Changed base class to BaseResponseWithTagInformation and added setTags() method
server/src/main/java/com/cloud/api/query/dao/DomainJoinDaoImpl.java Added logic to retrieve and populate tags when creating domain responses
server/src/main/java/com/cloud/api/ApiResponseHelper.java Added logic to retrieve and populate tags in createDomainResponse() method and reorganized imports
ui/src/components/view/InfoCard.vue Added 'Domain' to the list of supported resources for tag display

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +118 to +127
List<ResourceTagJoinVO> tags = ApiDBUtils.listResourceTagViewByResourceUUID(domain.getUuid(),
ResourceTag.ResourceObjectType.Domain);
if (CollectionUtils.isNotEmpty(tags)) {
Set<ResourceTagResponse> tagResponses = new HashSet<>();
for (ResourceTagJoinVO tag : tags) {
ResourceTagResponse tagResponse = ApiDBUtils.newResourceTagResponse(tag, true);
tagResponses.add(tagResponse);
}
domainResponse.setTags(tagResponses);
}
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

This tag retrieval and population logic is duplicated in ApiResponseHelper.createDomainResponse(). Consider extracting this into a shared helper method to avoid code duplication and maintain consistency.

Suggested change
List<ResourceTagJoinVO> tags = ApiDBUtils.listResourceTagViewByResourceUUID(domain.getUuid(),
ResourceTag.ResourceObjectType.Domain);
if (CollectionUtils.isNotEmpty(tags)) {
Set<ResourceTagResponse> tagResponses = new HashSet<>();
for (ResourceTagJoinVO tag : tags) {
ResourceTagResponse tagResponse = ApiDBUtils.newResourceTagResponse(tag, true);
tagResponses.add(tagResponse);
}
domainResponse.setTags(tagResponses);
}
ApiResponseHelper.populateDomainTags(domain.getUuid(), domainResponse);

Copilot uses AI. Check for mistakes.
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.

Feature: Domain Tagging

1 participant