Search in sources :

Example 1 with MaintenanceVdsParameters

use of org.ovirt.engine.core.common.action.MaintenanceVdsParameters in project ovirt-engine by oVirt.

the class HostMaintenanceCallback method evaluateMaintenanceHostCommandProgress.

/**
 * Evaluates the host status in regards to maintenance status: The host must move to {@code VDSStatus.Maintenance}
 * in order to stop gluster service
 *
 * @param maintenanceCommand
 *            The root command
 */
private void evaluateMaintenanceHostCommandProgress(MaintenanceVdsCommand<MaintenanceVdsParameters> maintenanceCommand) {
    MaintenanceVdsParameters parameters = maintenanceCommand.getParameters();
    VdsDynamic host = vdsDynamicDao.get(parameters.getVdsId());
    switch(host.getStatus()) {
        // Wait till moving to maintenance ends
        case PreparingForMaintenance:
            break;
        // Stop Gluster processes
        case Maintenance:
            log.info("Host '{}' is on maintenance mode. Stoping all gluster services.", getHostName(parameters.getVdsId()));
            stopGlusterServices(parameters.getVdsId());
            maintenanceCommand.setCommandStatus(CommandStatus.SUCCEEDED);
            break;
        // Any other status implies maintenance action failed, and the callback cannot proceed with stopping gluster's services
        default:
            if (isMaintenanceCommandExecuted(maintenanceCommand)) {
                log.info("Host '{}' failed to move to maintenance mode. Could not stop Gluster services.", getHostName(parameters.getVdsId()));
                maintenanceCommand.setCommandStatus(CommandStatus.FAILED);
            }
            break;
    }
}
Also used : VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) MaintenanceVdsParameters(org.ovirt.engine.core.common.action.MaintenanceVdsParameters)

Example 2 with MaintenanceVdsParameters

use of org.ovirt.engine.core.common.action.MaintenanceVdsParameters in project ovirt-engine by oVirt.

the class MaintenanceNumberOfVdssCommand method migrateAllVdss.

private void migrateAllVdss() {
    for (Guid vdsId : vdssToMaintenance.keySet()) {
        // ParametersCurrentUser = CurrentUser
        MaintenanceVdsParameters tempVar = new MaintenanceVdsParameters(vdsId, getParameters().getIsInternal(), getParameters().isStopGlusterService());
        tempVar.setSessionId(getParameters().getSessionId());
        tempVar.setCorrelationId(getParameters().getCorrelationId());
        ActionReturnValue result = runInternalAction(ActionType.MaintenanceVds, tempVar, ExecutionHandler.createInternalJobContext(getContext()));
        if (!result.isValid()) {
            getReturnValue().getValidationMessages().addAll(result.getValidationMessages());
            getReturnValue().setValid(false);
        }
    }
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) MaintenanceVdsParameters(org.ovirt.engine.core.common.action.MaintenanceVdsParameters) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

MaintenanceVdsParameters (org.ovirt.engine.core.common.action.MaintenanceVdsParameters)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)1 Guid (org.ovirt.engine.core.compat.Guid)1