Search in sources :

Example 6 with VDSStatus

use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.

the class ResourceManager method addVds.

public void addVds(VDS vds, boolean isInternal, boolean scheduleJobs) {
    VdsManager vdsManager = vdsManagerFactory.create(vds, this);
    if (isInternal) {
        VDSStatus status = vds.getStatus();
        switch(vds.getStatus()) {
            case Error:
                status = VDSStatus.Up;
                break;
            case Reboot:
            case NonResponsive:
            case Connecting:
            case Installing:
                status = VDSStatus.Unassigned;
                break;
        }
        if (status != vds.getStatus()) {
            vdsManager.setStatus(status, vds);
            vdsManager.updateStatisticsData(vds.getStatisticsData());
        }
        // set pending to 0
        vds.setPendingVcpusCount(0);
        vdsManager.updateDynamicData(vds.getDynamicData());
    }
    if (scheduleJobs) {
        vdsManager.scheduleJobs();
    }
    vdsManagersDict.put(vds.getId(), vdsManager);
    log.info("VDS '{}' was added to the Resource Manager", vds.getId());
}
Also used : VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus)

Example 7 with VDSStatus

use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.

the class VdsManager method processRefreshCapabilitiesResponse.

public VDSStatus processRefreshCapabilitiesResponse(AtomicBoolean processHardwareCapsNeeded, VDS vds, VDS oldVDS, VDSReturnValue caps) {
    if (caps.getSucceeded()) {
        // hence warning in case of permissive as well.
        if (vds.getSELinuxEnforceMode() == null || vds.getSELinuxEnforceMode().equals(SELinuxMode.DISABLED) || (vds.getClusterSupportsGlusterService() && vds.getSELinuxEnforceMode().equals(SELinuxMode.PERMISSIVE))) {
            AuditLogable auditLogable = createAuditLogableForHost(vds);
            auditLogable.addCustomValue("Mode", vds.getSELinuxEnforceMode() == null ? "UNKNOWN" : vds.getSELinuxEnforceMode().name());
            auditLogDirector.log(auditLogable, AuditLogType.VDS_NO_SELINUX_ENFORCEMENT);
            if (vds.getSELinuxEnforceMode() != null) {
                log.warn("Host '{}' is running with SELinux in '{}' mode", vds.getName(), vds.getSELinuxEnforceMode());
            } else {
                log.warn("Host '{}' does not report SELinux enforcement information.", vds.getName());
            }
        }
        VDSStatus returnStatus = vds.getStatus();
        NonOperationalReason nonOperationalReason = getHostNetworkTopologyPersister().persistAndEnforceNetworkCompliance(vds);
        if (nonOperationalReason != NonOperationalReason.NONE) {
            setIsSetNonOperationalExecuted(true);
            if (returnStatus != VDSStatus.NonOperational) {
                log.debug("monitoring: vds '{}' networks do not match its cluster networks, vds will be moved to NonOperational", vds);
                vds.setStatus(VDSStatus.NonOperational);
                vds.setNonOperationalReason(nonOperationalReason);
            }
        }
        // We process the software capabilities.
        VDSStatus oldStatus = vds.getStatus();
        if (oldStatus != VDSStatus.Up) {
            // persist to db the host's cpu_flags.
            // TODO this needs to be revisited - either all the logic is in-memory or based on db
            vdsDynamicDao.updateCpuFlags(vds.getId(), vds.getCpuFlags());
            processHostFeaturesReported(vds);
            monitoringStrategy.processHardwareCapabilities(vds);
        }
        monitoringStrategy.processSoftwareCapabilities(vds);
        returnStatus = vds.getStatus();
        if (returnStatus != oldStatus && returnStatus == VDSStatus.NonOperational) {
            setIsSetNonOperationalExecuted(true);
        }
        processHardwareCapsNeeded.set(monitoringStrategy.processHardwareCapabilitiesNeeded(oldVDS, vds));
        return returnStatus;
    } else if (caps.getExceptionObject() != null) {
        throw caps.getExceptionObject();
    } else {
        log.error("refreshCapabilities:GetCapabilitiesVDSCommand failed with no exception!");
        throw new RuntimeException(caps.getExceptionString());
    }
}
Also used : VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) NonOperationalReason(org.ovirt.engine.core.common.businessentities.NonOperationalReason)

Example 8 with VDSStatus

use of org.ovirt.engine.core.common.businessentities.VDSStatus 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 9 with VDSStatus

use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.

the class FenceVdsBaseCommand method executeCommand.

@Override
protected void executeCommand() {
    log.info("Power-Management: {} of host '{}' initiated.", getAction(), getVdsName());
    audit(AuditLogType.FENCE_OPERATION_STARTED);
    VDSStatus lastStatus = getVds().getStatus();
    FenceOperationResult result = null;
    try {
        setup();
        result = createHostFenceActionExecutor(getVds(), getParameters().getFencingPolicy()).fence(getAction());
        handleResult(result);
        if (getSucceeded()) {
            log.info("Power-Management: {} host '{}' succeeded.", getAction(), getVdsName());
            audit(AuditLogType.FENCE_OPERATION_SUCCEEDED);
        } else {
            log.info("Power-Management: {} host '{}' failed.", getAction(), getVdsName());
            audit(AuditLogType.FENCE_OPERATION_FAILED);
        }
    } finally {
        if (!getSucceeded()) {
            setStatus(lastStatus);
            if (result != null && result.getStatus() != Status.SKIPPED_DUE_TO_POLICY) {
                // show alert only if command was not skipped due to fencing policy
                alertIfPowerManagementOperationFailed();
            }
            throw new EngineException(EngineError.VDS_FENCE_OPERATION_FAILED);
        } else {
            teardown();
        }
    }
}
Also used : VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) EngineException(org.ovirt.engine.core.common.errors.EngineException)

Example 10 with VDSStatus

use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.

the class StartVdsCommand method validate.

@Override
protected boolean validate() {
    boolean retValue = super.validate();
    VDS vds = getVds();
    if (vds != null) {
        VDSStatus vdsStatus = vds.getStatus();
        if (vdsStatus == VDSStatus.Connecting) {
            retValue = false;
            addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_VDS_INTERMITENT_CONNECTIVITY);
        } else if (!legalStatusForStartingVds(vdsStatus)) {
            addValidationMessage(EngineMessage.VDS_STATUS_NOT_VALID_FOR_START);
            retValue = false;
            log.error("VDS status for vds '{}' '{}' is '{}'", vds.getId(), vds.getName(), vdsStatus);
        }
    }
    return retValue;
}
Also used : VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) VDS(org.ovirt.engine.core.common.businessentities.VDS)

Aggregations

VDSStatus (org.ovirt.engine.core.common.businessentities.VDSStatus)11 VDS (org.ovirt.engine.core.common.businessentities.VDS)3 ImageResource (com.google.gwt.resources.client.ImageResource)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 Field (java.lang.reflect.Field)1 PostConstruct (javax.annotation.PostConstruct)1 Test (org.junit.Test)1 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)1 FenceVdsActionParameters (org.ovirt.engine.core.common.action.FenceVdsActionParameters)1 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 EditableVdsField (org.ovirt.engine.core.common.businessentities.EditableVdsField)1 NonOperationalReason (org.ovirt.engine.core.common.businessentities.NonOperationalReason)1 VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)1 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)1 FenceOperationResult (org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult)1 EngineException (org.ovirt.engine.core.common.errors.EngineException)1 Guid (org.ovirt.engine.core.compat.Guid)1 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)1