Search in sources :

Example 1 with FenceVdsActionParameters

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

the class HostListModel method onStop.

public void onStop() {
    ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VDS vds = (VDS) item;
        list.add(new FenceVdsActionParameters(vds.getId()));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.StopVds, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancelConfirm();
    }, model);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters) ArrayList(java.util.ArrayList) JsSingleValueStringObject(org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) HostMaintenanceConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 2 with FenceVdsActionParameters

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

the class HostListModel method start.

public void start() {
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VDS vds = (VDS) item;
        list.add(new FenceVdsActionParameters(vds.getId()));
    }
    Frontend.getInstance().runMultipleAction(ActionType.StartVds, list, result -> {
    }, null);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters) ArrayList(java.util.ArrayList) JsSingleValueStringObject(org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 3 with FenceVdsActionParameters

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

the class HostListModel method onRestart.

public void onRestart() {
    ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VDS vds = (VDS) item;
        list.add(new FenceVdsActionParameters(vds.getId()));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RestartVds, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancelConfirm();
    }, model);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters) ArrayList(java.util.ArrayList) JsSingleValueStringObject(org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) HostMaintenanceConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 4 with FenceVdsActionParameters

use of org.ovirt.engine.core.common.action.FenceVdsActionParameters 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);
    }
}
Also used : VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) VDS(org.ovirt.engine.core.common.businessentities.VDS) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters) MaintenanceNumberOfVdssParameters(org.ovirt.engine.core.common.action.MaintenanceNumberOfVdssParameters) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters) Guid(org.ovirt.engine.core.compat.Guid) VdsPowerDownParameters(org.ovirt.engine.core.common.action.VdsPowerDownParameters)

Example 5 with FenceVdsActionParameters

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

the class PmHealthCheckManager method fenceHosts.

/**
 * This method calls the non-responding treatment command
 * if host that was non-responding in the quite-time in which
 * fencing is skipped is still non-responding after the quite-time
 * period passed.
 */
public void fenceHosts(List<VDS> hosts) {
    for (VDS host : hosts) {
        // retrieve the current status from DB
        host = vdsDao.get(host.getId());
        // Check if host exists, has power management and is still in non-responsive status after quite time.
        if (host != null && host.isPmEnabled() && host.getStatus() == VDSStatus.NonResponsive) {
            VdsNotRespondingTreatmentCommand<FenceVdsActionParameters> nonResponingVdsCommand = new VdsNotRespondingTreatmentCommand<>(new FenceVdsActionParameters(host.getId()), null);
            Backend.getInstance().runInternalAction(ActionType.VdsNotRespondingTreatment, nonResponingVdsCommand.getParameters());
        }
    }
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters)

Aggregations

FenceVdsActionParameters (org.ovirt.engine.core.common.action.FenceVdsActionParameters)8 VDS (org.ovirt.engine.core.common.businessentities.VDS)5 ArrayList (java.util.ArrayList)3 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)3 JsSingleValueStringObject (org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject)3 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)2 HostMaintenanceConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel)2 MaintenanceNumberOfVdssParameters (org.ovirt.engine.core.common.action.MaintenanceNumberOfVdssParameters)1 VdsActionParameters (org.ovirt.engine.core.common.action.VdsActionParameters)1 VdsPowerDownParameters (org.ovirt.engine.core.common.action.VdsPowerDownParameters)1 VDSStatus (org.ovirt.engine.core.common.businessentities.VDSStatus)1 Guid (org.ovirt.engine.core.compat.Guid)1