use of org.ovirt.engine.core.bll.provider.ProviderValidator in project ovirt-engine by oVirt.
the class RemoveNetworkCommand method getRemoveExternalNetworkValidationResult.
private ValidationResult getRemoveExternalNetworkValidationResult() {
ProviderNetwork providerNetwork = getNetwork().getProvidedBy();
if (providerNetwork == null || !getParameters().isRemoveFromNetworkProvider()) {
return ValidationResult.VALID;
}
ProviderValidator providerValidator = new ProviderValidator(getProvider());
return providerValidator.validateReadOnlyActions();
}
use of org.ovirt.engine.core.bll.provider.ProviderValidator in project ovirt-engine by oVirt.
the class AbstractVmProviderProxy method getProviderValidator.
public ProviderValidator getProviderValidator() {
return new ProviderValidator<P>(provider) {
@Override
public ValidationResult validateAddProvider() {
P properties = provider.getAdditionalProperties();
Guid proxyHostId = properties.getProxyHostId();
if (proxyHostId != null) {
VDS proxyHost = getVdsDao().get(proxyHostId);
if (proxyHost == null) {
return new ValidationResult(EngineMessage.VDS_DOES_NOT_EXIST);
}
if (!proxyHost.getStoragePoolId().equals(properties.getStoragePoolId())) {
return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VDS_NOT_IN_DEST_STORAGE_POOL);
}
}
return ValidationResult.VALID;
}
private VdsDao getVdsDao() {
return DbFacade.getInstance().getVdsDao();
}
};
}
Aggregations