Search in sources :

Example 1 with SetHaMaintenanceParameters

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);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) SetHaMaintenanceParameters(org.ovirt.engine.core.common.action.SetHaMaintenanceParameters)

Example 2 with SetHaMaintenanceParameters

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);
}
Also used : SetHaMaintenanceParameters(org.ovirt.engine.core.common.action.SetHaMaintenanceParameters) EngineException(org.ovirt.engine.core.common.errors.EngineException) SetHaMaintenanceModeVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SetHaMaintenanceModeVDSCommandParameters)

Example 3 with SetHaMaintenanceParameters

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);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) WebApplicationException(javax.ws.rs.WebApplicationException) SetHaMaintenanceParameters(org.ovirt.engine.core.common.action.SetHaMaintenanceParameters)

Aggregations

SetHaMaintenanceParameters (org.ovirt.engine.core.common.action.SetHaMaintenanceParameters)3 WebApplicationException (javax.ws.rs.WebApplicationException)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 EngineException (org.ovirt.engine.core.common.errors.EngineException)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 SetHaMaintenanceModeVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SetHaMaintenanceModeVDSCommandParameters)1