use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class ManageNetworkClustersCommand method validateInputForDuplication.
private ValidationResult validateInputForDuplication() {
final Set<NetworkClusterId> networkClusterIds = new HashSet<>();
final Iterable<NetworkCluster> inputNetworkClusters = Stream.of(getParameters().getAttachments(), getParameters().getDetachments(), getParameters().getUpdates()).flatMap(Collection::stream).collect(Collectors.toList());
for (NetworkCluster networkCluster : inputNetworkClusters) {
if (networkClusterIds.contains(networkCluster.getId())) {
final String networkClusterReplacement = String.format("${NetworkCluster} %s", networkCluster.getId());
return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DUPLICATE_NETWORK_CLUSTER_INPUT, networkClusterReplacement);
} else {
networkClusterIds.add(networkCluster.getId());
}
}
return ValidationResult.VALID;
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class NetworkClusterHelper method setStatus.
public void setStatus(Guid clusterId, final Collection<Network> networks) {
final RequiredNetworkClusterStatusUpdater requiredNetworkClusterStatusUpdater = new RequiredNetworkClusterStatusUpdater(clusterId);
for (Network network : networks) {
NetworkCluster networkCluster = networkClusterDao.get(new NetworkClusterId(clusterId, network.getId()));
boolean doUpdateNetworkClusterStatus = networkCluster != null;
if (doUpdateNetworkClusterStatus) {
if (networkCluster.isRequired()) {
requiredNetworkClusterStatusUpdater.update(networkCluster, network.getName());
} else {
updateNetworkClusterStatus(networkCluster, NetworkStatus.OPERATIONAL);
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class NetworkHelper method attachNetworkToClusters.
public ActionReturnValue attachNetworkToClusters(Guid networkId, Collection<Guid> clusterIds) {
List<NetworkCluster> networkAttachments = createNetworkClusters(clusterIds);
networkAttachments.forEach(networkAttachment -> networkAttachment.setNetworkId(networkId));
return backend.runInternalAction(ActionType.ManageNetworkClusters, new ManageNetworkClustersParameters(networkAttachments));
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class PropagateNetworksToClusterHostsCommand method mapParametersByClusterId.
private Map<Guid, ManageNetworkClustersParameters> mapParametersByClusterId() {
ManageNetworkClustersParameters parameters = getParameters();
Map<Guid, List<NetworkCluster>> attachmentByClusterId = groupByClusterId(parameters.getAttachments());
Map<Guid, List<NetworkCluster>> detachmentByClusterId = groupByClusterId(parameters.getDetachments());
Map<Guid, List<NetworkCluster>> updatesByClusterId = groupByClusterId(parameters.getUpdates());
Set<Guid> clusterIds = Stream.of(attachmentByClusterId, detachmentByClusterId, updatesByClusterId).flatMap(e -> e.keySet().stream()).collect(Collectors.toSet());
return clusterIds.stream().collect(Collectors.toMap(Function.identity(), clusterId -> new ManageNetworkClustersParameters(nullToEmptyList(attachmentByClusterId.get(clusterId)), nullToEmptyList(detachmentByClusterId.get(clusterId)), nullToEmptyList(updatesByClusterId.get(clusterId)))));
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class NetworkAttachmentValidator method bootProtocolSetForRoleNetwork.
public ValidationResult bootProtocolSetForRoleNetwork() {
NetworkCluster networkCluster = getNetworkCluster();
IsRoleNetworkIpConfigurationValid isRoleNetworkIpConfigurationValid = new IsRoleNetworkIpConfigurationValid(networkCluster);
return ValidationResult.failWith(EngineMessage.ACTION_TYPE_FAILED_ROLE_NETWORK_HAS_NO_BOOT_PROTOCOL, ReplacementUtils.createSetVariableString(VAR_ACTION_TYPE_FAILED_ROLE_NETWORK_HAS_NO_BOOT_PROTOCOL_ENTITY, getNetwork().getName())).unless(isRoleNetworkIpConfigurationValid.validate(attachment));
}
Aggregations