Search in sources :

Example 1 with NonOperationalReason

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

the class HostNetworkTopologyPersisterImpl method persistAndEnforceNetworkCompliance.

@Override
public NonOperationalReason persistAndEnforceNetworkCompliance(VDS host, boolean skipManagementNetwork, UserConfiguredNetworkData userConfiguredData) {
    return TransactionSupport.executeInScope(TransactionScopeOption.Required, () -> {
        List<VdsNetworkInterface> dbIfaces = interfaceDao.getAllInterfacesForVds(host.getId());
        List<Network> clusterNetworks = networkDao.getAllForCluster(host.getClusterId());
        persistTopology(host, dbIfaces, clusterNetworks, userConfiguredData);
        NonOperationalReason nonOperationalReason = enforceNetworkCompliance(host, skipManagementNetwork, clusterNetworks);
        auditNetworkCompliance(host, dbIfaces, clusterNetworks);
        return nonOperationalReason;
    });
}
Also used : NonOperationalReason(org.ovirt.engine.core.common.businessentities.NonOperationalReason) Network(org.ovirt.engine.core.common.businessentities.network.Network) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)

Example 2 with NonOperationalReason

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

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

the class FenceProxyLocatorTest method findProxyHostExcludesNonOperationalHosts.

/**
 * Checks if the locator excludes NonOperational host as a proxy host, if it's NonOperationalReason is
 * NETWORK_UNREACHABLE. And because specified host is the only existing host, no proxy is selected.
 */
@Test
public void findProxyHostExcludesNonOperationalHosts() {
    mockExistingHosts(createHost());
    FenceProxyLocator locator = setupLocator();
    for (NonOperationalReason reason : NonOperationalReason.values()) {
        VDS host = createHost();
        host.setStatus(VDSStatus.NonOperational);
        host.setNonOperationalReason(reason);
        mockExistingHosts(host);
        assertEquals(reason == NonOperationalReason.NETWORK_UNREACHABLE, locator.findProxyHost(false) == null);
    }
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) NonOperationalReason(org.ovirt.engine.core.common.businessentities.NonOperationalReason) Test(org.junit.Test)

Aggregations

NonOperationalReason (org.ovirt.engine.core.common.businessentities.NonOperationalReason)3 Test (org.junit.Test)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 VDSStatus (org.ovirt.engine.core.common.businessentities.VDSStatus)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)1