Search in sources :

Example 1 with ResetIrsVDSCommandParameters

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

the class FenceVdsManualyCommand method resetSPM.

private void resetSPM() {
    log.info("Start reset of SPM. Spm vds id: '{}'", getStoragePool().getSpmVdsId());
    if (getStoragePool().getSpmVdsId() != null) {
        ResetIrsVDSCommandParameters resetIrsParams = new ResetIrsVDSCommandParameters(getStoragePool().getId(), getStoragePool().getSpmVdsId());
        resetIrsParams.setVdsAlreadyRebooted(true);
        runVdsCommand(VDSCommandType.ResetIrs, resetIrsParams);
    }
}
Also used : ResetIrsVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.ResetIrsVDSCommandParameters)

Example 2 with ResetIrsVDSCommandParameters

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

the class SetVdsStatusVDSCommand method executeVdsIdCommand.

@Override
protected void executeVdsIdCommand() {
    final SetVdsStatusVDSCommandParameters parameters = getParameters();
    if (_vdsManager != null) {
        final VDS vds = getVds();
        if (vds.getSpmStatus() != VdsSpmStatus.None && parameters.getStatus() != VDSStatus.Up) {
            log.info("VDS '{}' is spm and moved from up calling resetIrs.", vds.getName());
            // check if this host was spm and reset if do.
            getVDSReturnValue().setSucceeded(resourceManager.runVdsCommand(VDSCommandType.ResetIrs, new ResetIrsVDSCommandParameters(vds.getStoragePoolId(), vds.getId())).getSucceeded());
            if (!getVDSReturnValue().getSucceeded()) {
                if (getParameters().isStopSpmFailureLogged()) {
                    AuditLogable base = new AuditLogableImpl();
                    base.setVdsId(vds.getId());
                    base.setVdsName(vds.getName());
                    auditLogDirector.log(base, AuditLogType.VDS_STATUS_CHANGE_FAILED_DUE_TO_STOP_SPM_FAILURE);
                }
                if (parameters.getStatus() == VDSStatus.PreparingForMaintenance) {
                    // ResetIrs command failed, SPM host status cannot be moved to Preparing For Maintenance
                    return;
                }
            }
        }
        TransactionSupport.executeInNewTransaction(() -> {
            _vdsManager.setStatus(parameters.getStatus(), vds);
            _vdsManager.updatePartialDynamicData(parameters.getNonOperationalReason(), parameters.getMaintenanceReason());
            _vdsManager.updateStatisticsData(vds.getStatisticsData());
            return null;
        });
    } else {
        getVDSReturnValue().setSucceeded(false);
    }
}
Also used : SetVdsStatusVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) ResetIrsVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.ResetIrsVDSCommandParameters) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 3 with ResetIrsVDSCommandParameters

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

the class ReconstructMasterDomainCommand method stopSpm.

protected boolean stopSpm() {
    boolean commandSucceeded = true;
    if (getStoragePool().getSpmVdsId() != null) {
        // if spm host id is different from selected host get the spm
        // in order to try and perform stop spm
        VDS spm;
        if (getStoragePool().getSpmVdsId().equals(getVds().getId())) {
            spm = getVds();
        } else {
            spm = vdsDao.get(getStoragePool().getSpmVdsId());
        }
        if (spm != null) {
            ResetIrsVDSCommandParameters tempVar2 = new ResetIrsVDSCommandParameters(getStoragePool().getId(), spm.getId());
            tempVar2.setIgnoreStopFailed(true);
            commandSucceeded = runVdsCommand(VDSCommandType.ResetIrs, tempVar2).getSucceeded();
            // if spm host is up switch to use it in the following logic
            if (spm.getStatus() == VDSStatus.Up) {
                setVdsId(spm.getId());
                setVds(spm);
            }
        }
    }
    return commandSucceeded;
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) ResetIrsVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.ResetIrsVDSCommandParameters)

Aggregations

ResetIrsVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.ResetIrsVDSCommandParameters)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 SetVdsStatusVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters)1 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)1 AuditLogableImpl (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)1