Martin Sivák has posted comments on this change.
Change subject: engine: Update Power Saving policy with power management
......................................................................
Patch Set 4:
(14 comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
Line 178: AlertIfPowerManagementOperationFailed();
Line 179: }
Line 180:
Line 181: // Successful fencing with reboot or shutdown op. Clear
the power management policy flag
Line 182: else if (EnumSet.of(FenceActionType.Restart,
FenceActionType.Stop).contains(getParameters().getAction())
Done
Line 183: && getParameters().getKeepPolicyPMEnabled() ==
false){
Line 184: getVds().setPowerManagementControlledByPolicy(false);
Line 185:
DbFacade.getInstance().getVdsDynamicDao().update(getVds().getDynamicData());
Line 186: }
Line 181: // Successful fencing with reboot or shutdown op. Clear
the power management policy flag
Line 182: else if (EnumSet.of(FenceActionType.Restart,
FenceActionType.Stop).contains(getParameters().getAction())
Line 183: && getParameters().getKeepPolicyPMEnabled() ==
false){
Line 184: getVds().setPowerManagementControlledByPolicy(false);
Line 185:
DbFacade.getInstance().getVdsDynamicDao().update(getVds().getDynamicData());
Done
Line 186: }
Line 187: }
Line 188: }
Line 189:
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceNumberOfVdssCommand.java
Line 146: if (!getParameters().getKeepPolicyPMEnabled()) {
Line 147: for (Guid vdsId : getParameters().getVdsIdList()) {
Line 148: VDS vds =
DbFacade.getInstance().getVdsDao().get(vdsId);
Line 149: vds.setPowerManagementControlledByPolicy(false);
Line 150:
DbFacade.getInstance().getVdsDynamicDao().update(vds.getDynamicData());
Done
Line 151: }
Line 152: }
Line 153:
Line 154: setSucceeded(true);
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/PowerSavingBalancePolicyUnit.java
Line 42: Map<String, String> parameters,
Line 43: ArrayList<String> messages) {
Line 44: final Pair<List<Guid>, Guid> migrationRule =
super.balance(cluster, hosts, parameters, messages);
Line 45:
Line 46: List<VDS> allHosts =
DbFacade.getInstance().getVdsDao().getAllForVdsGroup(cluster.getId());
This list is used to compute the list of all empty/maintenance hosts in the
cluster. I need all hosts here, not only the hosts that were short listed by
the user.
Line 47:
Line 48: Pair<VDS, VDSStatus> action = evaluatePowerManagementSituation(
Line 49: getDownHosts(allHosts, parameters),
Line 50: getMaintenanceHosts(allHosts, parameters),
Line 49: getDownHosts(allHosts, parameters),
Line 50: getMaintenanceHosts(allHosts, parameters),
Line 51: getEmptyHosts(allHosts, parameters),
Line 52: parameters
Line 53: );
Done
Line 54:
Line 55: if (action != null) processPmAction(action);
Line 56:
Line 57: return migrationRule;
Line 51: getEmptyHosts(allHosts, parameters),
Line 52: parameters
Line 53: );
Line 54:
Line 55: if (action != null) processPmAction(action);
Done
Line 56:
Line 57: return migrationRule;
Line 58: }
Line 59:
Line 71: if (targetStatus == VDSStatus.Maintenance && currentStatus ==
VDSStatus.Up) {
Line 72: logAction(vds, AuditLogType.PM_POLICY_UP_TO_MAINTENANCE);
Line 73:
Line 74: /* Up -> Maint */
Line 75: List<Guid> vdsList = new ArrayList<>(1);
It will contain only one host. Why should I be reserving more (default is 10)
memory?
Line 76: vdsList.add(vds.getId());
Line 77: MaintenanceNumberOfVdssParameters parameters = new
MaintenanceNumberOfVdssParameters(vdsList, true, true);
Line 78:
Backend.getInstance().runInternalAction(VdcActionType.MaintenanceNumberOfVdss,
Line 79: parameters,
Line 106: parameters,
Line 107: ExecutionHandler.createInternalJobContext());
Line 108: }
Line 109: else {
Line 110: /* Should not ever happen... */
Done
Line 111: }
Line 112: }
Line 113:
Line 114: /**
Line 122: @Override
Line 123: public boolean eval(VDS vds) {
Line 124: return vds.getStatus() == VDSStatus.Up
Line 125: && vds.getVmCount() == 0
Line 126: && vds.getVmMigrating() == 0
???
Line 127: && vds.getPendingVmemSize() == 0
Line 128: && vds.getPendingVcpusCount() == 0;
Line 129: }
Line 130: });
Line 164: @Override
Line 165: public boolean eval(VDS vds) {
Line 166: return vds.getStatus() == VDSStatus.Down
Line 167: && vds.isPowerManagementControlledByPolicy()
Line 168: && vds.isDisablePowerManagementPolicy() ==
false;
I wanted to make it more explicit, but OK.
Line 169: }
Line 170: });
Line 171:
Line 172: return emptyHosts;
Line 186: Map<String,
String> parameters) {
Line 187: final int requiredReserve =
tryParseWithDefault(parameters.get("HostsInReserve"), Config
Line 188: .<Integer> getValue(ConfigValues.HostsInReserve));
Line 189: final int enableAutoPM =
tryParseWithDefault(parameters.get("EnableAutomaticHostPowerManagement"), Config
Line 190: .<Integer>
getValue(ConfigValues.EnableAutomaticHostPowerManagement));
That is what the tryParseWithDefault is doing, I used the same method I saw in
other PolicyUnits we have.
And I like that name :) The method does exactly that.
Line 191:
Line 192: /* Automatic power management is disabled */
Line 193: if (enableAutoPM == 0) return null;
Line 194:
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/FenceVdsActionParameters.java
Line 11: * pass true so we keep the powerManagementControlledByPolicy flag
set.
Line 12: *
Line 13: * If the user triggered this action, clear the flag.
Line 14: */
Line 15: private boolean _keepPolicyPMEnabled = false;
_ was superfluous (was we have that elsewhere as well), but I would like to
clearly see the false value instead of depending on hidden java initialization
here.
Line 16:
Line 17: public FenceVdsActionParameters(Guid vdsId, FenceActionType
action) {
Line 18: super(vdsId);
Line 19: _action = action;
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/MaintenanceNumberOfVdssParameters.java
Line 16: * pass true so we keep the powerManagementControlledByPolicy flag
set.
Line 17: *
Line 18: * If the user triggered this action, clear the flag.
Line 19: */
Line 20: private boolean _keepPolicyPMEnabled = false;
Also the same :)
Line 21:
Line 22: public MaintenanceNumberOfVdssParameters(java.util.List<Guid>
vdsIdList, boolean isInternal) {
Line 23: _vdsIdList = vdsIdList;
Line 24: _isInternal = isInternal;
....................................................
File
packaging/dbscripts/upgrade/03_04_0350_add_power_management_to_cluster_policy.sql
Line 2: "CpuOverCommitDurationMinutes" : "^([1-9])$",
Line 3: "HighUtilization" : "^([5-9][0-9])$",
Line 4: "LowUtilization" : "^([1-4][0-9])$",
Line 5: "HostsInReserve": "^[0-9][0-9]*$",
Line 6: "EnableAutomaticHostPowerManagement": "^[01]$"
Done
--
To view, visit http://gerrit.ovirt.org/22488
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2da9f4e019c3dd006caefbaa9baf9a533ce41f3d
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <[email protected]>
Gerrit-Reviewer: Adam Litke <[email protected]>
Gerrit-Reviewer: Doron Fediuck <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Itamar Heim <[email protected]>
Gerrit-Reviewer: Martin Sivák <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches