Search in sources :

Example 11 with VdsStatic

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

the class GetErratumByIdForHostQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    VdsStatic host = hostStaticDao.get(getParameters().getId());
    if (host == null || host.getHostProviderId() == null) {
        return;
    }
    Provider<?> provider = providerDao.get(host.getHostProviderId());
    if (provider != null) {
        HostProviderProxy proxy = providerProxyFactory.create(provider);
        getQueryReturnValue().setReturnValue(proxy.getErratumForHost(host.getHostName(), getParameters().getErratumId()));
    }
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) HostProviderProxy(org.ovirt.engine.core.bll.host.provider.HostProviderProxy)

Example 12 with VdsStatic

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

the class ReportedConfigurationsFillerTest method setUp.

@Before
public void setUp() {
    hostId = Guid.newGuid();
    clusterId = Guid.newGuid();
    VdsStatic vdsStatic = new VdsStatic();
    vdsStatic.setId(hostId);
    vdsStatic.setClusterId(clusterId);
    reportedDnsResolverConfiguration = new DnsResolverConfiguration();
    VdsDynamic vdsDynamic = new VdsDynamic();
    vdsDynamic.setId(hostId);
    vdsDynamic.setReportedDnsResolverConfiguration(reportedDnsResolverConfiguration);
    baseNic = createNic("eth0");
    vlanNic = createNic("eth0.1");
    vlanNic.setBaseInterface(baseNic.getName());
    baseNicNetwork = createNetwork("baseNicNetwork");
    vlanNetwork = createNetwork("vlanNicNetwork");
    vlanNetwork.setVlanId(1);
    baseNicNetworkQos = new HostNetworkQos();
    baseNicNetworkQos.setId(baseNicNetwork.getQosId());
    vlanNetworkQos = new HostNetworkQos();
    vlanNetworkQos.setId(vlanNetwork.getQosId());
    when(vdsStaticDao.get(hostId)).thenReturn(vdsStatic);
    when(vdsDynamicDao.get(hostId)).thenReturn(vdsDynamic);
    cluster = new Cluster();
    cluster.setCompatibilityVersion(Version.v4_1);
    when(clusterDao.get(any())).thenReturn(cluster);
}
Also used : HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) EffectiveHostNetworkQos(org.ovirt.engine.core.vdsbroker.EffectiveHostNetworkQos) VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration) Before(org.junit.Before)

Example 13 with VdsStatic

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

the class GlusterDBUtils method getServer.

/**
 * Returns a server from the given cluster, having give host name or IP address.
 *
 * @return VDS object for the server if found, else null
 */
public VdsStatic getServer(Guid clusterId, String hostnameOrIp) {
    // first check for hostname
    VdsStatic server = vdsStaticDao.getByHostName(hostnameOrIp);
    if (server != null) {
        return server.getClusterId().equals(clusterId) ? server : null;
    }
    // then for ip
    List<VdsNetworkInterface> ifaces;
    try {
        ifaces = interfaceDao.getAllInterfacesWithIpAddress(clusterId, InetAddress.getByName(hostnameOrIp).getHostAddress());
        switch(ifaces.size()) {
            case 0:
                // not found
                return null;
            case 1:
                return vdsStaticDao.get(ifaces.get(0).getVdsId());
            default:
                // multiple servers in the DB having this ip address!
                throw new RuntimeException("There are multiple servers in DB having same IP address " + hostnameOrIp);
        }
    } catch (UnknownHostException e) {
        throw new RuntimeException(e);
    }
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) UnknownHostException(java.net.UnknownHostException) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)

Example 14 with VdsStatic

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

the class HostMaintenanceCallback method getHostName.

private String getHostName(Guid hostId) {
    if (hostName == null) {
        VdsStatic host = vdsStaticDao.get(hostId);
        hostName = host == null ? null : host.getName();
    }
    return hostName;
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic)

Example 15 with VdsStatic

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

the class UpdateVdsCommand method checkKdumpIntegrationStatus.

private void checkKdumpIntegrationStatus() {
    VdsStatic vdsSt = getParameters().getVdsStaticData();
    if (vdsSt.isPmEnabled() && vdsSt.isPmKdumpDetection()) {
        VdsDynamic vdsDyn = vdsDynamicDao.get(vdsSt.getId());
        if (vdsDyn != null && vdsDyn.getKdumpStatus() != KdumpStatus.ENABLED) {
            AuditLogable logable = new AuditLogableImpl();
            logable.setVdsId(vdsSt.getId());
            logable.setVdsName(vdsSt.getName());
            auditLogDirector.log(logable, AuditLogType.KDUMP_DETECTION_NOT_CONFIGURED_ON_VDS);
        }
    }
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Aggregations

VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)49 Test (org.junit.Test)10 Guid (org.ovirt.engine.core.compat.Guid)8 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Map (java.util.Map)3 Objects (java.util.Objects)3 Before (org.junit.Before)3 HostProviderProxy (org.ovirt.engine.core.bll.host.provider.HostProviderProxy)3 VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)3 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)3 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2 StringUtils (org.apache.commons.lang.StringUtils)2 Host (org.ovirt.engine.api.model.Host)2