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);
}
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;
}
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);
}
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;
}
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());
}
Aggregations