use of org.ovirt.engine.core.common.utils.MapNetworkAttachments in project ovirt-engine by oVirt.
the class HostSetupNetworksCommand method getRemovedNetworks.
private Set<String> getRemovedNetworks() {
if (removedNetworks == null) {
List<NetworkAttachment> removedNetworkAttachments = Entities.filterEntitiesByRequiredIds(getParameters().getRemovedNetworkAttachments(), existingAttachments);
removedNetworks = new HashSet<>(removedNetworkAttachments.size());
Map<Guid, NetworkAttachment> networkIdToAttachment = new MapNetworkAttachments(getParameters().getNetworkAttachments()).byNetworkId();
for (NetworkAttachment removedAttachment : removedNetworkAttachments) {
if (!networkIdToAttachment.containsKey(removedAttachment.getNetworkId())) {
removedNetworks.add(existingNetworkRelatedToAttachment(removedAttachment).getVdsmName());
}
}
}
return removedNetworks;
}
use of org.ovirt.engine.core.common.utils.MapNetworkAttachments in project ovirt-engine by oVirt.
the class PersistentHostSetupNetworksParametersFactory method getNetworksToSync.
/**
* For given host and it's networks, return network attachments representing those networks on this host.
* @param hostId host ID
* @param networks networks to transform
* @return network attachments representing given networks on this host.
*/
private Map<Network, NetworkAttachment> getNetworksToSync(Guid hostId, List<Network> networks) {
List<NetworkAttachment> allAttachmentsOfHost = networkAttachmentDao.getAllForHost(hostId);
Map<Guid, NetworkAttachment> attachmentsByNetworkId = new MapNetworkAttachments(allAttachmentsOfHost).byNetworkId();
Map<Network, NetworkAttachment> networksToSync = new HashMap<>();
for (Network network : networks) {
Guid networkId = network.getId();
NetworkAttachment attachmentToSync = attachmentsByNetworkId.get(networkId);
if (attachmentToSync != null && !attachmentToSync.isQosOverridden()) {
attachmentToSync.setOverrideConfiguration(true);
networksToSync.put(network, attachmentToSync);
}
}
return networksToSync;
}
Aggregations