use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostSetupNetworksModel method findPhysicalFunction.
private VdsNetworkInterface findPhysicalFunction(Map<Guid, VdsNetworkInterface> nicsById, Guid nicId) {
final boolean vf = vfMap.containsKey(nicId);
final VdsNetworkInterface physicalFunction;
if (vf) {
final Guid pfId = vfMap.get(nicId);
physicalFunction = nicsById.get(pfId);
} else {
physicalFunction = null;
}
return physicalFunction;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostSetupNetworksModel method createModelsForUnamangedNetworks.
public void createModelsForUnamangedNetworks(Map<String, Set<LogicalNetworkModel>> nicToNetworks) {
for (VdsNetworkInterface nic : allExistingNics) {
if (shouldCreateUnmanagedNetworkModel(nic)) {
LogicalNetworkModel networkModel = createUnmanagedNetworkModel(nic.getNetworkName(), nic);
networkModelByName.put(networkModel.getName(), networkModel);
String baseNicName = NetworkCommonUtils.stripVlan(nic);
if (!nicToNetworks.containsKey(baseNicName)) {
nicToNetworks.put(baseNicName, new HashSet<LogicalNetworkModel>());
}
nicToNetworks.get(baseNicName).add(networkModel);
}
}
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostSetupNetworksModel method createSlaveModels.
private List<NetworkInterfaceModel> createSlaveModels(Map<String, List<VdsNetworkInterface>> bondNameToSlaves, final Map<Guid, VdsNetworkInterface> nicsById, String bondName) {
List<NetworkInterfaceModel> slavesModels = new ArrayList<>();
for (VdsNetworkInterface slave : bondNameToSlaves.get(bondName)) {
NetworkInterfaceModel slaveModel = createSlaveModel(nicsById, slave);
slavesModels.add(slaveModel);
}
return slavesModels;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostSetupNetworksModel method createRegularNicModels.
private Map<String, NetworkInterfaceModel> createRegularNicModels(Map<String, Set<LogicalNetworkModel>> nicNameToNetworkModels, Map<String, List<VdsNetworkInterface>> bondNameToSlaves, Map<String, List<NetworkLabelModel>> nicNameToLabelModels, final Map<Guid, VdsNetworkInterface> nicsById) {
Map<String, NetworkInterfaceModel> regularNicModels = new HashMap<>();
for (VdsNetworkInterface nic : allExistingNics) {
if (!isPhysicalNic(nic, bondNameToSlaves.keySet(), getAllSlaveNames())) {
continue;
}
final VdsNetworkInterface physicalFunction = findPhysicalFunction(nicsById, nic.getId());
if (physicalFunction != null && !getShowVf().getEntity()) {
continue;
}
String nicName = nic.getName();
Collection<LogicalNetworkModel> nicNetworks = nicNameToNetworkModels.get(nicName);
NetworkInterfaceModel nicModel = new NetworkInterfaceModel(nic, nicNetworks, nicNameToLabelModels.get(nicName), nicToVfsConfig.containsKey(nic.getId()), physicalFunction == null ? null : physicalFunction.getName(), this);
regularNicModels.put(nicName, nicModel);
}
return regularNicModels;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostInterfaceListModel method updateItems.
private void updateItems(Iterable<VdsNetworkInterface> source) {
ArrayList<HostInterfaceLineModel> items = new ArrayList<>();
setOriginalItems((ArrayList<VdsNetworkInterface>) source);
List<Bond> nonEmptyBonds = new ArrayList<>();
List<Nic> independentNics = new ArrayList<>();
Map<String, List<Nic>> bondToNics = new HashMap<>();
Map<String, List<Vlan>> nicToVlans = new HashMap<>();
sortNics();
classifyNics(nonEmptyBonds, independentNics, bondToNics, nicToVlans);
// create all bond models
for (Bond bond : nonEmptyBonds) {
HostInterfaceLineModel model = lineModelFromBond(bond);
items.add(model);
// add contained interface models - should exist, but check just in case
if (bondToNics.containsKey(bond.getName())) {
for (Nic nic : bondToNics.get(bond.getName())) {
model.getInterfaces().add(hostInterfaceFromNic(nic));
}
}
// add any corresponding VLAN bridge models
model.getVLans().addAll(gatherVlans(bond, nicToVlans));
}
// create all independent NIC models
for (Nic nic : independentNics) {
HostInterfaceLineModel model = lineModelFromInterface(nic);
model.getInterfaces().add(hostInterfaceFromNic(nic));
items.add(model);
// add any corresponding VLAN bridge models
model.getVLans().addAll(gatherVlans(nic, nicToVlans));
}
setItems(items);
updateActionAvailability();
}
Aggregations