Search in sources :

Example 16 with NetworkCluster

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

the class AddClusterCommand method attachManagementNetwork.

private void attachManagementNetwork() {
    final NetworkCluster networkCluster = createManagementNetworkCluster();
    networkCluster.setClusterId(getClusterId());
    networkClusterDao.save(networkCluster);
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster)

Example 17 with NetworkCluster

use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster 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 18 with NetworkCluster

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

the class GetInterfacesByLabelForNetworkQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    Network network = networkDao.get(getParameters().getId());
    Set<VdsNetworkInterface> interfacesByLabelForNetwork = new HashSet<>();
    if (network == null) {
        getQueryReturnValue().setReturnValue(interfacesByLabelForNetwork);
        return;
    }
    List<NetworkCluster> clusters = networkClusterDao.getAllForNetwork(network.getId());
    if (clusters.isEmpty()) {
        getQueryReturnValue().setReturnValue(interfacesByLabelForNetwork);
        return;
    }
    List<VdsNetworkInterface> labeledNics = new ArrayList<>();
    for (NetworkCluster networkCluster : clusters) {
        labeledNics.addAll(interfaceDao.getAllInterfacesByLabelForCluster(networkCluster.getClusterId(), network.getLabel()));
    }
    if (labeledNics.isEmpty()) {
        getQueryReturnValue().setReturnValue(interfacesByLabelForNetwork);
        return;
    }
    List<VdsNetworkInterface> networkNics = interfaceDao.getVdsInterfacesByNetworkId(network.getId());
    Map<String, VdsNetworkInterface> labeledNicsByName = Entities.entitiesByName(labeledNics);
    for (VdsNetworkInterface networkNic : networkNics) {
        if (labeledNicsByName.containsKey(NetworkCommonUtils.stripVlan(networkNic))) {
            interfacesByLabelForNetwork.add(networkNic);
        }
    }
    getQueryReturnValue().setReturnValue(interfacesByLabelForNetwork);
}
Also used : 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) HashSet(java.util.HashSet)

Example 19 with NetworkCluster

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

the class ManagementNetworkUtilImplTest method createNetwork.

private Network createNetwork(boolean isManagementNetwork, String name) {
    NetworkCluster networkCluster = new NetworkCluster();
    networkCluster.setManagement(isManagementNetwork);
    Network network = new Network();
    network.setName(name);
    network.setCluster(networkCluster);
    return network;
}
Also used : Network(org.ovirt.engine.core.common.businessentities.network.Network) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster)

Example 20 with NetworkCluster

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

the class NetworkClusterValidatorTestBase method setup.

@Before
public void setup() {
    network = createNetwork();
    networkCluster = createNetworkCluster();
    cluster = new Cluster();
    validator = spy(createValidator());
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) Before(org.junit.Before)

Aggregations

NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)62 Test (org.junit.Test)19 Network (org.ovirt.engine.core.common.businessentities.network.Network)17 ArrayList (java.util.ArrayList)15 NetworkClusterId (org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)7 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)6 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)6 ManageNetworkClustersParameters (org.ovirt.engine.core.common.action.ManageNetworkClustersParameters)5 List (java.util.List)4 Map (java.util.Map)4 PairQueryable (org.ovirt.engine.core.common.utils.PairQueryable)4 Guid (org.ovirt.engine.core.compat.Guid)4 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)3 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2