Search in sources :

Example 1 with DnsResolverConfiguration

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

the class NetworkInSyncWithVdsNetworkInterfaceTest method reverseNameServersOrder.

private DnsResolverConfiguration reverseNameServersOrder(DnsResolverConfiguration sampleDnsResolverConfiguration) {
    List<NameServer> reversedNameServers = sampleDnsResolverConfiguration.getNameServers();
    Collections.reverse(reversedNameServers);
    DnsResolverConfiguration result = new DnsResolverConfiguration();
    result.setNameServers(reversedNameServers);
    return result;
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Example 2 with DnsResolverConfiguration

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

the class VdsBrokerObjectsBuilder method setDnsResolverConfigurationData.

private static void setDnsResolverConfigurationData(VDS vds, Map<String, Object> struct) {
    String[] nameServersAddresses = assignStringArrayValue(struct, VdsProperties.name_servers);
    if (nameServersAddresses != null) {
        List<NameServer> nameServers = Stream.of(nameServersAddresses).map(NameServer::new).collect(Collectors.toList());
        DnsResolverConfiguration reportedDnsResolverConfiguration = new DnsResolverConfiguration();
        reportedDnsResolverConfiguration.setNameServers(nameServers);
        DnsResolverConfiguration oldDnsResolverConfiguration = vds.getReportedDnsResolverConfiguration();
        if (oldDnsResolverConfiguration != null) {
            reportedDnsResolverConfiguration.setId(oldDnsResolverConfiguration.getId());
        }
        vds.getDynamicData().setReportedDnsResolverConfiguration(reportedDnsResolverConfiguration);
    }
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Example 3 with DnsResolverConfiguration

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

the class DnsConfigurationModel method flush.

public DnsResolverConfiguration flush() {
    Boolean shouldSetDnsConfiguration = this.shouldSetDnsConfiguration.getEntity();
    if (!shouldSetDnsConfiguration) {
        return null;
    }
    List<NameServer> nameServers = new ArrayList<>();
    for (NameServerModel nameServerModel : this.nameServerModelListModel.getItems()) {
        nameServers.add(new NameServer(nameServerModel.flush()));
    }
    DnsResolverConfiguration result = new DnsResolverConfiguration();
    result.setNameServers(nameServers);
    if (getEntity() != null) {
        result.setId(getEntity().getId());
    }
    return result;
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) ArrayList(java.util.ArrayList) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Example 4 with DnsResolverConfiguration

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

the class HostSetupNetworksCommand method calculateNetworksToConfigure.

private List<HostNetwork> calculateNetworksToConfigure() {
    List<HostNetwork> networksToConfigure = new ArrayList<>(getParameters().getNetworkAttachments().size());
    BusinessEntityMap<VdsNetworkInterface> nics = getExistingNicsBusinessEntityMap();
    for (NetworkAttachment attachment : getAttachmentsWithMissingUpdatedDefaultRoute()) {
        Network network = existingNetworkRelatedToAttachment(attachment);
        NetworkCluster networkCluster = network.getCluster();
        HostNetwork networkToConfigure = new HostNetwork(network, attachment);
        networkToConfigure.setBonding(isBonding(attachment, nics));
        boolean isDefaultRoute = defaultRouteSupported() && networkCluster.isDefaultRoute();
        if (isDefaultRoute) {
            DnsResolverConfiguration dnsResolverConfiguration = getDnsConfigurationFromNetworkOrItsAttachment(attachment, network);
            if (dnsResolverConfiguration != null) {
                networkToConfigure.setNameServers(dnsResolverConfiguration.getNameServers());
            }
        }
        // TODO: YZ - should default route be set separately for IPv4 and IPv6
        networkToConfigure.setDefaultRoute(isDefaultRoute);
        if (NetworkUtils.qosConfiguredOnInterface(attachment, network)) {
            networkToConfigure.setQosConfiguredOnInterface(true);
            HostNetworkQos hostNetworkQos = effectiveHostNetworkQos.getQos(attachment, network);
            networkToConfigure.setQos(hostNetworkQos);
        }
        networksToConfigure.add(networkToConfigure);
    }
    return networksToConfigure;
}
Also used : EffectiveHostNetworkQos(org.ovirt.engine.core.vdsbroker.EffectiveHostNetworkQos) HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) HostNetwork(org.ovirt.engine.core.common.vdscommands.HostNetwork) FindActiveVmsUsingNetwork(org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork) Network(org.ovirt.engine.core.common.businessentities.network.Network) ArrayList(java.util.ArrayList) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration) HostNetwork(org.ovirt.engine.core.common.vdscommands.HostNetwork) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Example 5 with DnsResolverConfiguration

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

the class HostSetupNetworksCommand method getDnsConfigurationFromNetworkOrItsAttachment.

private DnsResolverConfiguration getDnsConfigurationFromNetworkOrItsAttachment(NetworkAttachment attachment, Network network) {
    DnsResolverConfiguration networkAttachmentDnsResolverConfiguration = attachment.getDnsResolverConfiguration();
    if (networkAttachmentDnsResolverConfiguration != null) {
        return networkAttachmentDnsResolverConfiguration;
    }
    DnsResolverConfiguration networkDnsResolverConfiguration = network.getDnsResolverConfiguration();
    if (networkDnsResolverConfiguration != null) {
        return networkDnsResolverConfiguration;
    }
    return null;
}
Also used : DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Aggregations

DnsResolverConfiguration (org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)19 NameServer (org.ovirt.engine.core.common.businessentities.network.NameServer)9 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)5 HostNetworkQos (org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)4 Network (org.ovirt.engine.core.common.businessentities.network.Network)4 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)2 IpConfiguration (org.ovirt.engine.core.common.businessentities.network.IpConfiguration)2 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)2 EffectiveHostNetworkQos (org.ovirt.engine.core.vdsbroker.EffectiveHostNetworkQos)2 Map (java.util.Map)1 Test (org.junit.Test)1 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)1 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)1 VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)1 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)1 AnonymousHostNetworkQos (org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos)1