Search in sources :

Example 56 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class GetHostListFromExternalProviderQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    Provider hostProvider = getProvider();
    List<VDS> providerHosts = getProviderHosts(hostProvider, getParameters().getSearchFilter());
    if (providerHosts != null && getParameters().isFilterOutExistingHosts()) {
        filterOutExistingHosts(providerHosts);
    }
    getQueryReturnValue().setReturnValue(providerHosts);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 57 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class GetDiscoveredHostListFromExternalProviderQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    Provider hostProvider = getParameters().getProvider();
    List<ExternalDiscoveredHost> providerHosts = getProviderHosts(hostProvider);
    getQueryReturnValue().setReturnValue(providerHosts);
}
Also used : ExternalDiscoveredHost(org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 58 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class VdsCommand method validateNetworkProviderConfiguration.

protected boolean validateNetworkProviderConfiguration(Guid providerId, String networkMappings) {
    if (providerId == null) {
        return true;
    } else {
        Provider provider = providerDao.get(providerId);
        NetworkProviderValidator validator = new NetworkProviderValidator(provider);
        if (!(validate(validator.providerIsSet()) && validate(validator.providerTypeIsNetwork()))) {
            return false;
        }
        if ((provider.getType() == ProviderType.OPENSTACK_NETWORK) && !validateOpenstackNetworkProviderProperties(validator, networkMappings)) {
            return false;
        }
        return true;
    }
}
Also used : NetworkProviderValidator(org.ovirt.engine.core.bll.provider.NetworkProviderValidator) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 59 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class ClusterPopupView method initListBoxEditors.

private void initListBoxEditors() {
    dataCenterEditor = new ListModelListBoxEditor<>(new NameRenderer<StoragePool>());
    managementNetworkEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Network>() {

        @Override
        protected String renderNullSafe(Network network) {
            return network.getName();
        }
    });
    cpuEditor = new ListModelListBoxEditor<>(new AbstractRenderer<ServerCpu>() {

        @Override
        public String render(ServerCpu object) {
            return object != null ? object.getCpuName() : constants.autoDetect();
        }
    });
    versionEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Version>() {

        @Override
        public String renderNullSafe(Version object) {
            return object.toString();
        }
    });
    switchTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<SwitchType>());
    firewallTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<FirewallType>());
    defaultNetworkProviderEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Provider>() {

        @Override
        protected String renderNullSafe(Provider provider) {
            return provider.getName();
        }
    });
    architectureEditor = new ListModelListBoxEditor<>(new EnumRenderer<ArchitectureType>() {

        @Override
        public String render(ArchitectureType object) {
            if (object == null || object == ArchitectureType.undefined) {
                // only localize the 'undefined' enum value
                return super.render(object);
            } else {
                // all other (concrete) architectures should be displayed directly
                return object.toString();
            }
        }
    });
    clusterPolicyEditor = new ListModelListBoxEditor<>(new NameRenderer<ClusterPolicy>());
    hostsWithBrokenConnectivityThresholdEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Integer>() {

        @Override
        public String renderNullSafe(Integer object) {
            if (object == null) {
                return "";
            }
            NumberFormatRenderer renderer = new NumberFormatRenderer(NumberFormat.getPercentFormat());
            // Since this is a percentage renderer, you need to divide by 100 to get the right values to show.
            return renderer.render(object.doubleValue() / 100);
        }
    });
    autoConvergeEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.autoConverge(), constants.dontAutoConverge(), constants.inheritFromGlobal()));
    migrateCompressedEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.compress(), constants.dontCompress(), constants.inheritFromGlobal()));
    migrationBandwidthLimitTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<MigrationBandwidthLimitType>());
    migrationBandwidthLimitTypeEditor.hideLabel();
    migrationPolicyEditor = new ListModelListBoxEditor<>(new NameRenderer());
    migrationPolicyEditor.hideLabel();
    macPoolListEditor = new ListModelListBoxEditor<>(new NameRenderer<MacPool>());
    macPoolListEditor.setLabel(constants.clusterPopupMacPoolLabel());
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) BooleanRendererWithNullText(org.ovirt.engine.ui.common.widget.renderer.BooleanRendererWithNullText) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) AbstractRenderer(com.google.gwt.text.shared.AbstractRenderer) Version(org.ovirt.engine.core.compat.Version) NumberFormatRenderer(com.google.gwt.text.client.NumberFormatRenderer) Network(org.ovirt.engine.core.common.businessentities.network.Network) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer)

Example 60 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class ProviderValidatorTest method testValidateReadOnlyActions.

@Test
public void testValidateReadOnlyActions() {
    String providerName = "providerName";
    OpenstackNetworkProviderProperties additionalProperties = new OpenstackNetworkProviderProperties();
    additionalProperties.setReadOnly(true);
    Provider<AdditionalProperties> provider = new Provider<>();
    provider.setAdditionalProperties(additionalProperties);
    provider.setType(ProviderType.EXTERNAL_NETWORK);
    provider.setName(providerName);
    ProviderValidator validator = new ProviderValidator(provider);
    EngineMessage engineMessage = EngineMessage.ACTION_TYPE_FAILED_EXTERNAL_PROVIDER_IS_READ_ONLY;
    assertThat(validator.validateReadOnlyActions(), failsWith(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, providerName)));
    additionalProperties.setReadOnly(false);
    assertThat(validator.validateReadOnlyActions(), isValid());
    provider.setType(ProviderType.OPENSTACK_NETWORK);
    assertThat(validator.validateReadOnlyActions(), isValid());
}
Also used : AdditionalProperties(org.ovirt.engine.core.common.businessentities.Provider.AdditionalProperties) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) EngineMessage(org.ovirt.engine.core.common.errors.EngineMessage) Provider(org.ovirt.engine.core.common.businessentities.Provider) Test(org.junit.Test)

Aggregations

Provider (org.ovirt.engine.core.common.businessentities.Provider)63 ExternalHostProvider (org.ovirt.engine.api.model.ExternalHostProvider)10 ArrayList (java.util.ArrayList)7 ProviderQueryParameters (org.ovirt.engine.core.common.queries.ProviderQueryParameters)7 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)7 ProviderParameters (org.ovirt.engine.core.common.action.ProviderParameters)6 Test (org.junit.Test)5 VDS (org.ovirt.engine.core.common.businessentities.VDS)5 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)5 Guid (org.ovirt.engine.core.compat.Guid)5 List (java.util.List)4 OpenStackNetworkProvider (org.ovirt.engine.api.model.OpenStackNetworkProvider)4 OpenStackVolumeProvider (org.ovirt.engine.api.model.OpenStackVolumeProvider)4 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)4 ExternalDiscoveredHost (org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost)4 ExternalHostGroup (org.ovirt.engine.core.common.businessentities.ExternalHostGroup)4 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)4 ExternalProvider (org.ovirt.engine.api.model.ExternalProvider)3 OpenstackNetworkProviderProperties (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)3 ApplicationMode (org.ovirt.engine.core.common.mode.ApplicationMode)3