Search in sources :

Example 1 with ProviderValidator

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();
}
Also used : ProviderValidator(org.ovirt.engine.core.bll.provider.ProviderValidator) ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)

Example 2 with ProviderValidator

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();
        }
    };
}
Also used : ProviderValidator(org.ovirt.engine.core.bll.provider.ProviderValidator) VDS(org.ovirt.engine.core.common.businessentities.VDS) Guid(org.ovirt.engine.core.compat.Guid) ValidationResult(org.ovirt.engine.core.bll.ValidationResult)

Aggregations

ProviderValidator (org.ovirt.engine.core.bll.provider.ProviderValidator)2 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 ProviderNetwork (org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)1 Guid (org.ovirt.engine.core.compat.Guid)1