use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class ReportedConfigurationsFiller method fillReportedConfigurations.
public void fillReportedConfigurations(List<VdsNetworkInterface> allInterfacesForHost, BusinessEntityMap<Network> networkMap, List<NetworkAttachment> networkAttachments, DnsResolverConfiguration reportedDnsResolverConfiguration, Guid clusterId) {
Cluster cluster = clusterDao.get(clusterId);
Map<String, VdsNetworkInterface> networkNameToNicMap = nicsByNetworkId(allInterfacesForHost);
for (NetworkAttachment networkAttachment : networkAttachments) {
fillReportedConfigurations(networkNameToNicMap, networkMap, networkAttachment, reportedDnsResolverConfiguration, cluster);
}
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class VfSchedulerImpl method getNic.
private VdsNetworkInterface getNic(Guid nicId, Map<Guid, VdsNetworkInterface> fetchedNics) {
VdsNetworkInterface nic = fetchedNics.get(nicId);
if (nic == null) {
nic = interfaceDao.get(nicId);
fetchedNics.put(nicId, nic);
}
return nic;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class NetworkPolicyUnit method filter.
@Override
public List<VDS> filter(Cluster cluster, List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) {
if (hosts == null || hosts.isEmpty()) {
return Collections.emptyList();
}
List<VDS> toRemoveHostList = new ArrayList<>();
List<VmNetworkInterface> vmNICs = vmNetworkInterfaceDao.getAllForVm(vm.getId());
Guid clusterId = hosts.get(0).getClusterId();
List<Network> clusterNetworks = networkDao.getAllForCluster(clusterId);
Map<String, Network> networksByName = Entities.entitiesByName(clusterNetworks);
Map<Guid, List<String>> hostNics = interfaceDao.getHostNetworksByCluster(clusterId);
Network displayNetwork = NetworkUtils.getDisplayNetwork(clusterNetworks);
Map<Guid, VdsNetworkInterface> hostDisplayNics = getDisplayNics(displayNetwork);
for (VDS host : hosts) {
ValidationResult result = validateRequiredNetworksAvailable(host, vm, vmNICs, displayNetwork, networksByName, hostNics.get(host.getId()), hostDisplayNics.get(host.getId()));
if (result.isValid()) {
result = validatePassthroughVnics(vm.getId(), host, vmNICs);
}
if (!result.isValid()) {
toRemoveHostList.add(host);
messages.addMessages(host.getId(), result.getVariableReplacements());
messages.addMessages(host.getId(), result.getMessagesAsStrings());
}
}
hosts.removeAll(toRemoveHostList);
return hosts;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class BackendHostNicsResource method map.
@Override
protected VdsNetworkInterface map(HostNic entity, VdsNetworkInterface template) {
VdsNetworkInterface iface = super.map(entity, template);
if (entity.isSetNetwork()) {
if (entity.getNetwork().isSetId() || entity.getNetwork().isSetName()) {
org.ovirt.engine.core.common.businessentities.network.Network net = lookupNetwork(entity.getNetwork());
iface.setNetworkName(net.getName());
} else {
iface.setNetworkName(null);
}
}
return iface;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class BackendHostNicsResource method list.
@Override
public HostNics list() {
HostNics ret = new HostNics();
List<VdsNetworkInterface> ifaces = getCollection();
Map<String, Guid> networkNameToNetworkIdMap = mapNetworkNamesToNetworkIds();
Map<Guid, NetworkAttachment> attachmentsByNetworkId = getAttachmentsByNetworkId();
for (VdsNetworkInterface iface : ifaces) {
HostNic hostNic = populate(map(iface, ifaces), iface);
setCustomProperties(attachmentsByNetworkId, networkNameToNetworkIdMap, hostNic);
String networkName = iface.getNetworkName();
if (networkNameToNetworkIdMap.containsKey(networkName)) {
Guid networkId = networkNameToNetworkIdMap.get(networkName);
hostNic.getNetwork().setId(networkId.toString());
hostNic.getNetwork().setName(null);
}
ret.getHostNics().add(addLinks(hostNic));
}
return addActions(ret);
}
Aggregations