use of org.ovirt.engine.core.bll.validator.NetworkAttachmentValidator in project ovirt-engine by oVirt.
the class HostSetupNetworksValidator method validNewOrModifiedNetworkAttachments.
ValidationResult validNewOrModifiedNetworkAttachments() {
ValidationResult vr = ValidationResult.VALID;
Iterator<NetworkAttachment> iterator = params.getNetworkAttachments().iterator();
while (iterator.hasNext() && vr.isValid()) {
NetworkAttachment attachment = iterator.next();
NetworkAttachmentValidator validator = createNetworkAttachmentValidator(attachment);
vr = skipValidation(vr) ? vr : validator.networkAttachmentIsSet();
vr = skipValidation(vr) ? vr : modifiedAttachmentExists(attachment.getId());
vr = skipValidation(vr) ? vr : validator.networkExists();
vr = skipValidation(vr) ? vr : validateCoherentNicIdentification(attachment);
vr = skipValidation(vr) ? vr : validateCoherentNetworkIdentification(attachment);
vr = skipValidation(vr) ? vr : modifiedAttachmentNotRemoved(attachment);
vr = skipValidation(vr) ? vr : validateAttachmentNotReferenceVlanDevice(attachment);
vr = skipValidation(vr) ? vr : validator.existingAttachmentIsReused(existingAttachmentsByNetworkId);
vr = skipValidation(vr) ? vr : validateAttachmentAndNicReferenceSameLabelNotConflict(attachment);
vr = skipValidation(vr) ? vr : validator.notExternalNetwork();
vr = skipValidation(vr) ? vr : validator.networkAttachedToCluster();
vr = skipValidation(vr) ? vr : validator.bootProtocolSetForRoleNetwork();
vr = skipValidation(vr) ? vr : validator.nicNameIsSet();
vr = skipValidation(vr) ? vr : nicActuallyExistsOrReferencesNewBond(attachment);
vr = skipValidation(vr) ? vr : validator.networkNotChanged(existingAttachmentsById.get(attachment.getId()));
vr = skipValidation(vr) ? vr : networkAttachmentIpConfigurationValidator.validateNetworkAttachmentIpConfiguration(params.getNetworkAttachments());
boolean attachmentUpdated = !isNewAttachment(attachment.getId());
if (attachmentUpdated) {
vr = skipValidation(vr) ? vr : notMovingLabeledNetworkToDifferentNic(attachment);
}
}
return vr;
}
use of org.ovirt.engine.core.bll.validator.NetworkAttachmentValidator in project ovirt-engine by oVirt.
the class HostSetupNetworksValidator method validRemovedNetworkAttachments.
private ValidationResult validRemovedNetworkAttachments() {
List<Guid> invalidIds = Entities.idsNotReferencingExistingRecords(params.getRemovedNetworkAttachments(), existingAttachments);
if (!invalidIds.isEmpty()) {
EngineMessage engineMessage = EngineMessage.NETWORK_ATTACHMENTS_TO_BE_REMOVED_DOES_NOT_EXISTS;
return new ValidationResult(engineMessage, ReplacementUtils.getListVariableAssignmentString(engineMessage, invalidIds));
}
ValidationResult vr = ValidationResult.VALID;
Iterator<NetworkAttachment> iterator = removedNetworkAttachments.iterator();
while (iterator.hasNext() && vr.isValid()) {
NetworkAttachment attachment = iterator.next();
NetworkAttachmentValidator validator = createNetworkAttachmentValidator(attachment);
vr = skipValidation(vr) ? vr : validator.networkAttachmentIsSet();
vr = skipValidation(vr) ? vr : validator.notExternalNetwork();
vr = skipValidation(vr) ? vr : validator.notRemovingManagementNetwork();
vr = skipValidation(vr) ? vr : notRemovingLabeledNetworks(attachment);
vr = skipValidation(vr) ? vr : validateNotRemovingUsedNetworkByVms(attachment.getNetworkName());
}
return vr;
}
Aggregations