use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class HostNetworkTopologyPersisterImpl method skipManagementNetworkCheck.
private void skipManagementNetworkCheck(List<VdsNetworkInterface> ifaces, List<Network> clusterNetworks, Guid clusterId) {
final Network managementNetwork = managementNetworkUtil.getManagementNetwork(clusterId);
final String managementNetworkName = managementNetwork.getName();
for (VdsNetworkInterface iface : ifaces) {
if (managementNetworkName.equals(iface.getNetworkName())) {
return;
}
}
for (Iterator<Network> iterator = clusterNetworks.iterator(); iterator.hasNext(); ) {
Network network = iterator.next();
if (managementNetworkName.equals(network.getName())) {
iterator.remove();
break;
}
}
}
use of org.ovirt.engine.core.common.businessentities.network.Network 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;
});
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class HostNetworkTopologyPersisterImpl method findNetworksOnInterfaces.
private Collection<Network> findNetworksOnInterfaces(Collection<VdsNetworkInterface> ifaces, Map<String, Network> clusterNetworksByName) {
final Collection<Network> networks = new ArrayList<>();
for (VdsNetworkInterface iface : ifaces) {
final String interfaceNetworkName = iface.getNetworkName();
if (clusterNetworksByName.containsKey(interfaceNetworkName)) {
final Network network = clusterNetworksByName.get(interfaceNetworkName);
networks.add(network);
}
}
return networks;
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class HostNetworkTopologyPersisterImpl method logChangedDisplayNetwork.
private void logChangedDisplayNetwork(VDS host, Collection<Network> engineHostNetworks, Collection<VdsNetworkInterface> engineInterfaces) {
if (isVmRunningOnHost(host.getId())) {
final Network engineDisplayNetwork = findDisplayNetwork(host.getClusterId(), engineHostNetworks);
if (engineDisplayNetwork == null) {
return;
}
final IsNetworkOnInterfacePredicate isNetworkOnInterfacePredicate = new IsNetworkOnInterfacePredicate(engineDisplayNetwork.getName());
final VdsNetworkInterface vdsmDisplayInterface = host.getInterfaces().stream().filter(isNetworkOnInterfacePredicate).findFirst().orElse(null);
final VdsNetworkInterface engineDisplayInterface = engineInterfaces.stream().filter(isNetworkOnInterfacePredicate).findFirst().orElse(null);
final DisplayInterfaceEqualityPredicate displayIneterfaceEqualityPredicate = new DisplayInterfaceEqualityPredicate(engineDisplayInterface);
if (// the display interface is't on host anymore
vdsmDisplayInterface == null || !displayIneterfaceEqualityPredicate.test(vdsmDisplayInterface)) {
final AuditLogable loggable = createAuditLogForHost(host);
auditLogDirector.log(loggable, AuditLogType.NETWORK_UPDATE_DISPLAY_FOR_HOST_WITH_ACTIVE_VM);
}
}
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class HostNetworkTopologyPersisterImpl method getVmNetworksImplementedAsBridgeless.
private String getVmNetworksImplementedAsBridgeless(VDS host, List<Network> clusterNetworks) {
Map<String, VdsNetworkInterface> interfacesByNetworkName = NetworkUtils.hostInterfacesByNetworkName(host.getInterfaces());
List<String> networkNames = new ArrayList<>();
for (Network net : clusterNetworks) {
if (net.isVmNetwork() && interfacesByNetworkName.containsKey(net.getName()) && !interfacesByNetworkName.get(net.getName()).isBridged()) {
networkNames.add(net.getName());
}
}
return StringUtils.join(networkNames, ",");
}
Aggregations