Search in sources :

Example 1 with SetHaMaintenanceModeVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.SetHaMaintenanceModeVDSCommandParameters 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 2 with SetHaMaintenanceModeVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.SetHaMaintenanceModeVDSCommandParameters in project ovirt-engine by oVirt.

the class MaintenanceVdsCommand method executeCommand.

@Override
protected void executeCommand() {
    if (getVds().getStatus() == VDSStatus.Maintenance) {
        // nothing to do
        setSucceeded(true);
    } else {
        orderListOfRunningVmsOnVds(getVdsId());
        if (getVds().getHighlyAvailableIsConfigured()) {
            SetHaMaintenanceModeVDSCommandParameters params = new SetHaMaintenanceModeVDSCommandParameters(getVds(), HaMaintenanceMode.LOCAL, true);
            if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, params).getSucceeded()) {
                haMaintenanceFailed = true;
                // HA maintenance failure is fatal only if the Hosted Engine vm is running on this host
                if (isHostedEngineOnVds()) {
                    setSucceeded(false);
                    return;
                }
            }
        }
        setSucceeded(migrateAllVms(getExecutionContext()));
        // if non responsive move directly to maintenance
        if (getVds().getStatus() == VDSStatus.NonResponsive || getVds().getStatus() == VDSStatus.Connecting || getVds().getStatus() == VDSStatus.Down) {
            setVdsStatus(VDSStatus.Maintenance);
        }
    }
    // as the migration(s) is a step of this job, so this job must not be cleaned yet
    if (isVmsExist()) {
        ExecutionHandler.setAsyncJob(getExecutionContext(), true);
    }
}
Also used : SetHaMaintenanceModeVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SetHaMaintenanceModeVDSCommandParameters)

Aggregations

SetHaMaintenanceModeVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SetHaMaintenanceModeVDSCommandParameters)2 SetHaMaintenanceParameters (org.ovirt.engine.core.common.action.SetHaMaintenanceParameters)1 EngineException (org.ovirt.engine.core.common.errors.EngineException)1