Skip to content

realtime re-balance remote agents - #14001

Draft
DaanHoogland wants to merge 1 commit into
mainfrom
ghi9640-agent-lb-indirect-svm
Draft

realtime re-balance remote agents#14001
DaanHoogland wants to merge 1 commit into
mainfrom
ghi9640-agent-lb-indirect-svm

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Description

This PR relates to agent rebalancing on MSses see #9640 but applies to atachees .

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?

verify(clusteredAgentManagerImpl).loadDirectlyConnectedHost(hostVO, false);
}

// https://github.com/apache/cloudstack/issues/9640

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.

Suggested change
// https://github.com/apache/cloudstack/issues/9640

Comment on lines +1042 to +1046
// Indirectly connected agents (KVM hosts, SSVM, CPVM) dial in to a management server rather
// than being loaded directly by it, so this management server can't hand the host to a
// specific future owner the way it can for direct agents. Disconnect it instead: the agent
// reconnects on its own using its indirect agent LB configuration (the "host" global setting
// and indirect.agent.lb.algorithm), which is what actually determines its next owner.

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.

evaluate and redact comment

Comment on lines +158 to +160
// Indirectly connected agents (KVM hosts, SSVM, CPVM) dial in to a management server rather than
// being loaded directly by it, so they must be disconnected (and left to reconnect on their own)
// instead of going through the direct-agent rebalance dance that expects a ClusteredDirectAgentAttache.

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.

Suggested change
// Indirectly connected agents (KVM hosts, SSVM, CPVM) dial in to a management server rather than
// being loaded directly by it, so they must be disconnected (and left to reconnect on their own)
// instead of going through the direct-agent rebalance dance that expects a ClusteredDirectAgentAttache.

Comment on lines +1040 to +1053
final AgentAttache attache = findAttache(hostId);
if (attache != null && !(attache instanceof ClusteredDirectAgentAttache)) {
// Indirectly connected agents (KVM hosts, SSVM, CPVM) dial in to a management server rather
// than being loaded directly by it, so this management server can't hand the host to a
// specific future owner the way it can for direct agents. Disconnect it instead: the agent
// reconnects on its own using its indirect agent LB configuration (the "host" global setting
// and indirect.agent.lb.algorithm), which is what actually determines its next owner.
logger.debug("Host id={} ({}) is an indirectly connected agent; disconnecting it so it reconnects and picks a management server " +
"using its own load balancing configuration", hostId, attache);
result = handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true);
finishRebalance(hostId, futureOwnerId, result ? Event.RebalanceCompleted : Event.RebalanceFailed);
return result;
}

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.

new method, move comment to javadoc

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.41%. Comparing base (a7a293e) to head (0b0f83c).
⚠️ Report is 1 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (a7a293e) and HEAD (0b0f83c). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (a7a293e) HEAD (0b0f83c)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               main   #14001       +/-   ##
=============================================
- Coverage     19.73%    3.41%   -16.33%     
=============================================
  Files          6371      487     -5884     
  Lines        575784    41863   -533921     
  Branches      70478     7912    -62566     
=============================================
- Hits         113644     1429   -112215     
+ Misses       449788    40234   -409554     
+ Partials      12352      200    -12152     
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

Copy link
Copy Markdown
Contributor Author

@nvazquez , can you have a look at this and discuss if needed?

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.

1 participant