use of org.ovirt.engine.core.common.businessentities.network.VnicProfile in project ovirt-engine by oVirt.
the class VmNicValidator method profileValid.
/**
* @return <ul>
* <li>{@code EngineMessage.ACTION_TYPE_FAILED_VNIC_PROFILE_NOT_EXISTS} if the profile doesn't exist.</li>
* <li>{@code EngineMessage.NETWORK_NOT_EXISTS_IN_CURRENT_CLUSTER} if the network is not in the current
* cluster.</li>
* <li>{@code ValidationResult.VALID} otherwise.</li>
* </ul>
*/
public ValidationResult profileValid(Guid clusterId) {
if (nic.getVnicProfileId() != null) {
// Check that the profile exists
VnicProfile vnicProfile = getVnicProfile();
if (vnicProfile == null) {
return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VNIC_PROFILE_NOT_EXISTS);
}
// Check that the network exists in current cluster
Network network = getNetworkByVnicProfile(vnicProfile);
if (network == null || !isNetworkInCluster(network, clusterId)) {
return new ValidationResult(EngineMessage.NETWORK_NOT_EXISTS_IN_CURRENT_CLUSTER);
}
}
return ValidationResult.VALID;
}
Aggregations