use of org.ovirt.engine.core.common.action.SetHaMaintenanceParameters in project ovirt-engine by oVirt.
the class HostListModel method setGlobalHaMaintenance.
private void setGlobalHaMaintenance(boolean enabled) {
VDS vds = getSelectedItem();
if (vds == null || !vds.getHighlyAvailableIsConfigured()) {
return;
}
SetHaMaintenanceParameters params = new SetHaMaintenanceParameters(vds.getId(), HaMaintenanceMode.GLOBAL, enabled);
Frontend.getInstance().runAction(ActionType.SetHaMaintenance, params);
}
use of org.ovirt.engine.core.common.action.SetHaMaintenanceParameters in project ovirt-engine by oVirt.
the class SetHaMaintenanceCommand method executeCommand.
@Override
protected void executeCommand() {
boolean succeeded = false;
SetHaMaintenanceParameters params = getParameters();
try {
succeeded = runVdsCommand(VDSCommandType.SetHaMaintenanceMode, new SetHaMaintenanceModeVDSCommandParameters(getVds(), params.getMode(), params.getIsEnabled())).getSucceeded();
} catch (EngineException e) {
log.error("Could not {} {} Hosted Engine HA maintenance mode on host '{}'", params.getIsEnabled() ? "enable" : "disable", params.getMode().name().toLowerCase(), getVdsName());
}
getReturnValue().setSucceeded(succeeded);
}
use of org.ovirt.engine.core.common.action.SetHaMaintenanceParameters in project ovirt-engine by oVirt.
the class BackendVmResource method maintenance.
@Override
public Response maintenance(Action action) {
validateParameters(action, "maintenanceEnabled");
org.ovirt.engine.core.common.businessentities.VM entity = getEntity(org.ovirt.engine.core.common.businessentities.VM.class, QueryType.GetVmByVmId, new IdQueryParameters(guid), id);
if (!entity.isHostedEngine()) {
throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity("Moving to maintenance mode is currently only available for the VM containing the hosted engine.").build());
}
return doAction(ActionType.SetHaMaintenance, new SetHaMaintenanceParameters(entity.getRunOnVds(), HaMaintenanceMode.GLOBAL, action.isMaintenanceEnabled()), action);
}
Aggregations