Search in sources :

Example 1 with SetVdsStatusVDSCommandParameters

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

the class HostMonitoring method handleClassCastException.

private void handleClassCastException(ClassCastException cce) {
    // This should occur only if the vdsm API is not the same as the cluster API (version mismatch)
    log.error("Failure to refresh host '{}' runtime info. Incorrect vdsm version for cluster '{}': {}", vds.getName(), vds.getClusterName(), cce.getMessage());
    log.debug("Exception", cce);
    if (vds.getStatus() != VDSStatus.PreparingForMaintenance && vds.getStatus() != VDSStatus.Maintenance) {
        resourceManager.runVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(vds.getId(), VDSStatus.Error));
    }
}
Also used : SetVdsStatusVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters)

Example 2 with SetVdsStatusVDSCommandParameters

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

the class ManageGlusterServiceCommand method performActionForServicesOfServer.

private void performActionForServicesOfServer() {
    List<String> serviceList = getServiceList();
    VDSReturnValue returnValue = null;
    returnValue = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(getParameters().getServerId(), serviceList, getParameters().getActionType()));
    setSucceeded(returnValue.getSucceeded());
    if (!getSucceeded()) {
        handleVdsError(getAuditLogTypeValue(), returnValue.getVdsError().getMessage());
    } else {
        updateService(getParameters().getServerId(), (List<GlusterServerService>) returnValue.getReturnValue());
        // if glusterd was restarted, update peer status and host status
        if (getParameters().getServiceType() == ServiceType.GLUSTER && (GlusterConstants.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_RESTART.equals(getParameters().getActionType()) || GlusterConstants.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_START.equals(getParameters().getActionType()))) {
            glusterServerDao.updatePeerStatus(getParameters().getServerId(), PeerStatus.CONNECTED);
            // only if cluster supports only gluster service
            if (!getCluster().supportsVirtService()) {
                runVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(getVdsId(), VDSStatus.Initializing));
            }
        }
    }
}
Also used : SetVdsStatusVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters) GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) GlusterServiceVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 3 with SetVdsStatusVDSCommandParameters

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

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

the class MaintenanceNumberOfVdssCommand method setVdsStatusToPrepareForMaintenance.

private boolean setVdsStatusToPrepareForMaintenance(VDS vds) {
    boolean result = true;
    if (vds.getStatus() != VDSStatus.PreparingForMaintenance && vds.getStatus() != VDSStatus.NonResponsive && vds.getStatus() != VDSStatus.Down) {
        SetVdsStatusVDSCommandParameters params = new SetVdsStatusVDSCommandParameters(vds.getId(), VDSStatus.PreparingForMaintenance, getParameters().getReason());
        params.setStopSpmFailureLogged(true);
        result = runVdsCommand(VDSCommandType.SetVdsStatus, params).getSucceeded();
    }
    return result;
}
Also used : SetVdsStatusVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters)

Aggregations

SetVdsStatusVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters)4 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 GlusterServerService (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService)1 ResetIrsVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.ResetIrsVDSCommandParameters)1 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)1 GlusterServiceVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterServiceVDSParameters)1 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)1 AuditLogableImpl (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)1