Skip to content

small refactors on account manager - #11784

Draft
DaanHoogland wants to merge 4 commits into
apache:mainfrom
DaanHoogland:accountManagerRefactors
Draft

small refactors on account manager#11784
DaanHoogland wants to merge 4 commits into
apache:mainfrom
DaanHoogland:accountManagerRefactors

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Description

This PR does some small refactors encountered during trouble shooting. ...

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?

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

@DaanHoogland DaanHoogland modified the milestones: 4.23, 4.20.3 Oct 3, 2025
@codecov

codecov Bot commented Oct 3, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.41%. Comparing base (1cd2491) to head (40b5897).

❗ There is a different number of reports uploaded between BASE (1cd2491) and HEAD (40b5897). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (1cd2491) HEAD (40b5897)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               main   #11784       +/-   ##
=============================================
- Coverage     19.65%    3.41%   -16.25%     
=============================================
  Files          6368      487     -5881     
  Lines        574889    41867   -533022     
  Branches      70353     7912    -62441     
=============================================
- Hits         112985     1429   -111556     
+ Misses       449634    40238   -409396     
+ Partials      12270      200    -12070     
Flag Coverage Δ
uitests 3.41% <ø> (ø)
unittests ?

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.

@DaanHoogland
DaanHoogland requested a lite review from Copilot October 6, 2025 06:07

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

This PR performs small refactoring improvements to the AccountManagerImpl class to enhance code readability and maintainability. The changes include simplifying conditional logic, extracting reusable methods, and updating logging patterns.

  • Simplified multiple conditional statements to use direct return expressions
  • Extracted domain ID calculation logic into a reusable private method
  • Updated logging to use parameterized format and modern charset handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread server/src/main/java/com/cloud/user/AccountManagerImpl.java
@DaanHoogland
DaanHoogland marked this pull request as ready for review October 7, 2025 07:09
@DaanHoogland
DaanHoogland force-pushed the accountManagerRefactors branch from 9dc2f0d to bee7667 Compare December 8, 2025 15:34
@apache apache deleted a comment from blueorangutan Dec 8, 2025
@apache apache deleted a comment from blueorangutan Dec 8, 2025
@apache apache deleted a comment from blueorangutan Dec 8, 2025
@apache apache deleted a comment from blueorangutan Dec 8, 2025
@apache apache deleted a comment from blueorangutan Dec 8, 2025
@apache apache deleted a comment from blueorangutan Dec 8, 2025
@apache apache deleted a comment from blueorangutan Dec 8, 2025
@apache apache deleted a comment from blueorangutan Dec 8, 2025
@DaanHoogland
DaanHoogland force-pushed the accountManagerRefactors branch from bee7667 to 9c9bb32 Compare December 8, 2025 15:50
@apache apache deleted a comment from blueorangutan Dec 9, 2025

}

private static long getDomainIdFor(ControlledEntity entity) {

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.

Suggested change
private static long getDomainIdFor(ControlledEntity entity) {
private long getDomainIdFor(ControlledEntity entity) {

Can static be removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure, I think it can. Any pressing reason? It is a bit of a utility method and has no bearing on the manager internals.

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.

I don't think the keyword is useful here, but it's just a nitpicking. ;)

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

clgtm

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 1 out of 1 changed files in this pull request and generated 1 comment.


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

// Block when is not in the list of allowed IPs
if (!NetUtils.isIpInCidrList(loginIpAddress, accessAllowedCidrs.split(","))) {
logger.warn("Request by account '" + account.toString() + "' was denied since " + loginIpAddress.toString().replace("/", "") + " does not match " + accessAllowedCidrs);
logger.warn("Request by account '{}' was denied since {} does not match {}", account , loginIpAddress.toString().replace("/", ""), accessAllowedCidrs);

Copilot AI Dec 12, 2025

Copy link

Choose a reason for hiding this comment

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

There's an extra space before the comma after the first placeholder. The code has "account ," but it should be "account," for consistent formatting.

Suggested change
logger.warn("Request by account '{}' was denied since {} does not match {}", account , loginIpAddress.toString().replace("/", ""), accessAllowedCidrs);
logger.warn("Request by account '{}' was denied since {} does not match {}", account, loginIpAddress.toString().replace("/", ""), accessAllowedCidrs);

Copilot uses AI. Check for mistakes.
@DaanHoogland
DaanHoogland force-pushed the accountManagerRefactors branch from 10fa999 to a9df597 Compare December 23, 2025 19:41
@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.

@nvazquez

Copy link
Copy Markdown
Contributor

Hi @DaanHoogland is this PR still in progress?

Copilot AI review requested due to automatic review settings August 16, 2026 16:55

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 16, 2026 16:57

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@apache apache deleted a comment from blueorangutan Aug 16, 2026
@apache apache deleted a comment from blueorangutan Aug 16, 2026
@apache apache deleted a comment from blueorangutan Aug 16, 2026
@apache apache deleted a comment from blueorangutan Aug 16, 2026
@apache apache deleted a comment from borisstoyanov Aug 16, 2026
@apache apache deleted a comment from blueorangutan Aug 16, 2026
@apache apache deleted a comment from blueorangutan Aug 16, 2026
@apache apache deleted a comment from blueorangutan Aug 16, 2026
@apache apache deleted a comment from blueorangutan Aug 16, 2026
@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 18873

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.

9 participants