use of org.ovirt.engine.core.common.action.VdsPowerDownParameters in project ovirt-engine by oVirt.
the class HostListModel method onSshStop.
public void onSshStop() {
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VDS vds = (VDS) item;
VdsPowerDownParameters param = new VdsPowerDownParameters(vds.getId());
param.setFallbackToPowerManagement(false);
param.setKeepPolicyPMEnabled(true);
list.add(param);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.VdsPowerDown, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancelConfirm();
}, model);
}
use of org.ovirt.engine.core.common.action.VdsPowerDownParameters in project ovirt-engine by oVirt.
the class PowerSavingBalancePolicyUnit method processPmAction.
private void processPmAction(Pair<VDS, VDSStatus> action) {
VDS vds = action.getFirst();
VDSStatus currentStatus = vds.getStatus();
VDSStatus targetStatus = action.getSecond();
if (targetStatus == VDSStatus.Maintenance && currentStatus == VDSStatus.Up) {
logAction(vds, AuditLogType.PM_POLICY_UP_TO_MAINTENANCE);
/* Up -> Maint */
Guid[] vdsList = new Guid[] { vds.getId() };
MaintenanceNumberOfVdssParameters parameters = new MaintenanceNumberOfVdssParameters(Arrays.asList(vdsList), true, true);
Backend.getInstance().runInternalAction(ActionType.MaintenanceNumberOfVdss, parameters, ExecutionHandler.createInternalJobContext());
} else if (targetStatus == VDSStatus.Down && currentStatus == VDSStatus.Maintenance) {
logAction(vds, AuditLogType.PM_POLICY_MAINTENANCE_TO_DOWN);
/* Maint -> Down */
VdsPowerDownParameters parameters = new VdsPowerDownParameters(vds.getId());
parameters.setKeepPolicyPMEnabled(true);
Backend.getInstance().runInternalAction(ActionType.VdsPowerDown, parameters, ExecutionHandler.createInternalJobContext());
} else if (targetStatus == VDSStatus.Up && currentStatus == VDSStatus.Maintenance) {
logAction(vds, AuditLogType.PM_POLICY_TO_UP);
/* Maint -> Up */
VdsActionParameters parameters = new VdsActionParameters(vds.getId());
Backend.getInstance().runInternalAction(ActionType.ActivateVds, parameters, ExecutionHandler.createInternalJobContext());
} else if (targetStatus == VDSStatus.Up && currentStatus == VDSStatus.Down) {
logAction(vds, AuditLogType.PM_POLICY_TO_UP);
/* Down -> Up */
FenceVdsActionParameters parameters = new FenceVdsActionParameters(vds.getId());
Backend.getInstance().runInternalAction(ActionType.StartVds, parameters, ExecutionHandler.createInternalJobContext());
} else {
/* Should not ever happen... */
log.error("Unknown host power management transition '{}' -> '{}'", currentStatus, targetStatus);
}
}
Aggregations