use of org.ovirt.engine.core.dao.network.InterfaceDao in project ovirt-engine by oVirt.
the class NetworkClustersToSetupNetworksParametersTransformerImpl method createSetupNetworksParameters.
private List<PersistentHostSetupNetworksParameters> createSetupNetworksParameters(Map<Guid, List<Network>> attachNetworksByHost, Map<Guid, Map<String, VdsNetworkInterface>> labelsToNicsByHost, Map<Guid, List<Network>> detachNetworksByHost, Map<Guid, List<Network>> updates) {
final List<PersistentHostSetupNetworksParameters> parameters = new ArrayList<>(attachNetworksByHost.size());
final ManageNetworksParametersBuilder builder = manageNetworksParametersBuilderFactory.create(commandContext, interfaceDao, vdsStaticDao, networkClusterDao, networkAttachmentDao);
Set<Guid> hostIds = Stream.of(attachNetworksByHost, detachNetworksByHost, updates).flatMap(e -> e.keySet().stream()).collect(Collectors.toSet());
for (Guid hostId : hostIds) {
final Map<String, VdsNetworkInterface> nicsByLabel = labelsToNicsByHost.get(hostId);
parameters.add(builder.buildParameters(hostId, nullToEmptyList(attachNetworksByHost.get(hostId)), nullToEmptyList(detachNetworksByHost.get(hostId)), nicsByLabel == null ? Collections.emptyMap() : nicsByLabel, nullToEmptyList(updates.get(hostId))));
}
return parameters;
}
Aggregations