You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "nagaboinaramgopal (via GitHub)" <gi...@apache.org> on 2026/10/08 18:47:52 UTC

[PR] cluster DRS: power off under-utilized hosts and wake them on demand [cloudstack]

nagaboinaramgopal opened a new pull request, #14371:
URL: https://github.com/apache/cloudstack/pull/14371

   ### Description
   
   Extends the existing cluster DRS service with optional host power management. When a cluster
   drops below a configurable low utilization threshold, DRS disables an empty, out-of-band
   manageable host, records a durable host detail marking that DRS powered it off, and issues the
   out-of-band power-off. When the cluster rises above a high threshold, DRS powers a host it turned
   off earlier back on. At most one host is powered off or on per poll, and the remaining hosts must
   be able to carry the load before a host is released.
   
   A host is only powered off once it is genuinely empty. If no host is empty, an optional active
   evacuation mode drains the least-loaded releasable host (migrating its VMs to the others within
   the DRS migration budget) so a later poll can power it off once empty. Draining is disabled first
   so the allocator stops targeting it, and a drain that stops making progress (its migrations keep
   being rejected for affinity, host tags or storage) is abandoned and the host returned to service
   rather than being re-submitted forever. An optional predictive mode folds a short least-squares
   forecast of recent utilization into the decision, so a rising trend wakes a host sooner and a
   transient dip does not trigger a power-off.
   
   The power-off path is ordered so the durable marker is written before the irreversible power
   operation: a management-server crash in between leaves a host DRS still recognises and powers back
   on, never one stranded off. A host that comes back by any path is reconciled (re-enabled, unmarked)
   on the next poll, and a power-off whose command reports failure is left disabled and marked for
   reconciliation rather than assumed still running.
   
   Everything is off by default behind per-cluster settings: drs.power.management.enable,
   drs.power.management.low.threshold, drs.power.management.high.threshold,
   drs.power.management.evacuate.enable, drs.predictive.enable and drs.predictive.window. It requires
   automatic DRS and out-of-band management to be configured on the cluster. No schema change: it uses
   a host detail and config keys.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [x] 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
   
   - [x] Major
   - [ ] Minor
   
   ### How Has This Been Tested?
   
   Unit tests cover the decision and lifecycle logic: the release and wake thresholds, the predictive
   forecast, the first-fit placement pre-check, the power-off ordering (marker before the power
   operation, disable gated on the state transition, no rollback on an unconfirmed failure), the
   power-on marker handling, the in-flight-plan guard, and the drain lifecycle (wait while a batch is
   migrating, abandon on no progress or when VMs no longer fit, disable the candidate, power the
   emptied host off only while it is still manageable and releasable). 38 tests pass across
   ClusterDrsPowerManagementTest and ClusterDrsPowerOrchestrationTest.
   
   #### How did you try to break this feature and the system with this change?
   
   The logic was audited for the failure paths that matter for powering real hardware off: a
   management-server crash in the window between disabling, marking and powering off a host; a
   power-off command that reports failure after the host already went down; an accepted but
   unconfirmed power-on; a host returning by a path other than a DRS wake; the allocator placing new
   VMs on a host mid-drain; a drain whose VMs cannot actually be migrated; and a host going down or
   being disabled by an operator mid-drain. Power management is skipped entirely for a cluster that
   has a DRS migration plan in flight so a migration source or destination is never powered off under
   it. The sub-minute allocation race between powering a host off and its agent disconnecting is
   handled by disabling the host first and detaching its agent without investigation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] cluster DRS: power off under-utilized hosts and wake them on demand [cloudstack]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #14371:
URL: https://github.com/apache/cloudstack/pull/14371#issuecomment-6338799983

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/14371?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 3.69%. Comparing base ([`f03cffc`](https://app.codecov.io/gh/apache/cloudstack/commit/f03cffc19e6e055754b1a05e3359c4c75fa6854e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`4f416e9`](https://app.codecov.io/gh/apache/cloudstack/commit/4f416e983c16fd9bbe5c8cf983be69f9365a4fe5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 42 commits behind head on main.
   > :exclamation:  There is a different number of reports uploaded between BASE (f03cffc) and HEAD (4f416e9). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (f03cffc) | HEAD (4f416e9) |
   >|------|------|------|
   >|unittests|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##               main   #14371       +/-   ##
   =============================================
   - Coverage     20.21%    3.69%   -16.53%     
   =============================================
     Files          6426      491     -5935     
     Lines        580181    42220   -537961     
     Branches      71033     7974    -63059     
   =============================================
   - Hits         117282     1558   -115724     
   + Misses       450184    40436   -409748     
   + Partials      12715      226    -12489     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/14371/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/14371/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `3.69% <ø> (ø)` | |
   | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/14371/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/cloudstack/pull/14371?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org