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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to