Search in sources :

Example 6 with OpenstackNetworkProviderProperties

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

the class ProviderDaoTest method generateNewEntity.

@Override
protected Provider<?> generateNewEntity() {
    Provider<AdditionalProperties> provider = new Provider<>();
    provider.setId(generateNonExistingId());
    provider.setName("brovider");
    provider.setUrl("http://brovider.com/");
    provider.setType(ProviderType.OPENSTACK_NETWORK);
    OpenstackNetworkProviderProperties additionalProperties = new OpenstackNetworkProviderProperties();
    additionalProperties.setReadOnly(Boolean.FALSE);
    additionalProperties.setTenantName("10ant");
    additionalProperties.setPluginType(OpenstackNetworkPluginType.OPEN_VSWITCH.name());
    provider.setAdditionalProperties(additionalProperties);
    provider.setAuthUrl("http://keystone-server:35357/v2.0/");
    return provider;
}
Also used : AdditionalProperties(org.ovirt.engine.core.common.businessentities.Provider.AdditionalProperties) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 7 with OpenstackNetworkProviderProperties

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

the class NetworkExternalSubnetListModel method setCommandExecutionAllowedForProvider.

private void setCommandExecutionAllowedForProvider(Provider provider) {
    OpenstackNetworkProviderProperties properties = (OpenstackNetworkProviderProperties) provider.getAdditionalProperties();
    if (properties != null && properties.getReadOnly()) {
        setCommandExecutionAllowed(false);
        return;
    }
    setCommandExecutionAllowed(true);
}
Also used : OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)

Example 8 with OpenstackNetworkProviderProperties

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

the class ProviderDaoImpl method createFullParametersMapper.

@Override
protected MapSqlParameterSource createFullParametersMapper(Provider<?> entity) {
    MapSqlParameterSource mapper = createBaseProviderParametersMapper(entity);
    String tenantName = null;
    String pluginType = null;
    boolean readOnly = false;
    boolean autoSync = false;
    AgentConfiguration agentConfiguration = null;
    AdditionalProperties additionalProperties = null;
    if (entity.getAdditionalProperties() != null) {
        switch(entity.getType()) {
            case EXTERNAL_NETWORK:
            case OPENSTACK_NETWORK:
                OpenstackNetworkProviderProperties networkProperties = (OpenstackNetworkProviderProperties) entity.getAdditionalProperties();
                readOnly = networkProperties.getReadOnly();
                tenantName = networkProperties.getTenantName();
                pluginType = networkProperties.getPluginType();
                agentConfiguration = networkProperties.getAgentConfiguration();
                autoSync = networkProperties.getAutoSync();
                break;
            case OPENSTACK_IMAGE:
                OpenStackImageProviderProperties imageProperties = (OpenStackImageProviderProperties) entity.getAdditionalProperties();
                tenantName = imageProperties.getTenantName();
                break;
            case OPENSTACK_VOLUME:
                OpenStackVolumeProviderProperties volumeProperties = (OpenStackVolumeProviderProperties) entity.getAdditionalProperties();
                tenantName = volumeProperties.getTenantName();
                break;
            case VMWARE:
            case KVM:
            case XEN:
                additionalProperties = entity.getAdditionalProperties();
                break;
            default:
                break;
        }
    }
    // We always add the values since JdbcTeplate expects them to be set, otherwise it throws an exception.
    mapper.addValue("tenant_name", tenantName);
    mapper.addValue("plugin_type", pluginType);
    mapper.addValue("agent_configuration", SerializationFactory.getSerializer().serialize(agentConfiguration));
    mapper.addValue("additional_properties", SerializationFactory.getSerializer().serialize(additionalProperties));
    mapper.addValue("read_only", readOnly);
    mapper.addValue("auto_sync", autoSync);
    return mapper;
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) AgentConfiguration(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.AgentConfiguration) OpenStackVolumeProviderProperties(org.ovirt.engine.core.common.businessentities.storage.OpenStackVolumeProviderProperties) AdditionalProperties(org.ovirt.engine.core.common.businessentities.Provider.AdditionalProperties) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) OpenStackImageProviderProperties(org.ovirt.engine.core.common.businessentities.OpenStackImageProviderProperties)

Example 9 with OpenstackNetworkProviderProperties

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

the class ProviderModel method flush.

private void flush() {
    provider.setName(name.getEntity());
    provider.setType(type.getSelectedItem());
    provider.setDescription(description.getEntity());
    provider.setUrl(url.getEntity());
    provider.setIsUnmanaged(isUnmanaged.getEntity());
    if (isTypeNetwork()) {
        getNeutronAgentModel().flush(provider);
        OpenstackNetworkProviderProperties properties = (OpenstackNetworkProviderProperties) provider.getAdditionalProperties();
        properties.setReadOnly(readOnly.getEntity());
        properties.setAutoSync(autoSync.getEntity());
    } else if (isTypeOpenStackImage()) {
        provider.setAdditionalProperties(new OpenStackImageProviderProperties());
    } else if (isTypeOpenStackVolume()) {
        provider.setAdditionalProperties(new OpenStackVolumeProviderProperties(getDataCenter().getSelectedItem().getId()));
    } else if (isTypeVmware()) {
        provider.setAdditionalProperties(getVmwarePropertiesModel().getVmwareVmProviderProperties(dataCenter.getSelectedItem() != null ? dataCenter.getSelectedItem().getId() : null));
        provider.setUrl(getVmwarePropertiesModel().getUrl());
    } else if (isTypeKVM()) {
        provider.setUrl(getKvmPropertiesModel().getUrl().getEntity());
        provider.setAdditionalProperties(getKvmPropertiesModel().getKVMVmProviderProperties(dataCenter.getSelectedItem() != null ? dataCenter.getSelectedItem().getId() : null));
    } else if (isTypeXEN()) {
        provider.setUrl(getXenPropertiesModel().getUrl().getEntity());
        provider.setAdditionalProperties(getXenPropertiesModel().getXENVmProviderProperties(dataCenter.getSelectedItem() != null ? dataCenter.getSelectedItem().getId() : null));
    }
    boolean authenticationRequired = requiresAuthentication.getEntity();
    provider.setRequiringAuthentication(authenticationRequired);
    if (authenticationRequired) {
        provider.setUsername(getUsername().getEntity());
        provider.setPassword(getPassword().getEntity());
        if (getTenantName().getIsAvailable()) {
            TenantProviderProperties properties = (TenantProviderProperties) provider.getAdditionalProperties();
            if (properties == null) {
                properties = new TenantProviderProperties();
                provider.setAdditionalProperties(properties);
            }
            properties.setTenantName(getTenantName().getEntity());
        }
        provider.setAuthUrl(getAuthUrl().getEntity());
    } else {
        provider.setUsername(null);
        provider.setPassword(null);
        if (getTenantName().getIsAvailable()) {
            TenantProviderProperties properties = (TenantProviderProperties) provider.getAdditionalProperties();
            if (properties != null) {
                properties.setTenantName(null);
            }
        }
        provider.setAuthUrl(null);
    }
}
Also used : TenantProviderProperties(org.ovirt.engine.core.common.businessentities.TenantProviderProperties) OpenStackVolumeProviderProperties(org.ovirt.engine.core.common.businessentities.storage.OpenStackVolumeProviderProperties) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) OpenStackImageProviderProperties(org.ovirt.engine.core.common.businessentities.OpenStackImageProviderProperties)

Example 10 with OpenstackNetworkProviderProperties

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

the class ExternalNetworkSyncService method synchronize.

private void synchronize() {
    List<Provider<?>> networkProviders = providerDao.getAllByTypes(ProviderType.EXTERNAL_NETWORK, ProviderType.OPENSTACK_NETWORK);
    networkProviders.stream().filter(provider -> {
        OpenstackNetworkProviderProperties networkProperties = (OpenstackNetworkProviderProperties) provider.getAdditionalProperties();
        return networkProperties.getAutoSync();
    }).map(Provider::getId).distinct().forEach(providerId -> {
        backendInternal.runInternalAction(ActionType.SyncNetworkProvider, new IdParameters(providerId));
    });
}
Also used : OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) Logger(org.slf4j.Logger) ProviderDao(org.ovirt.engine.core.dao.provider.ProviderDao) LoggerFactory(org.slf4j.LoggerFactory) Provider(org.ovirt.engine.core.common.businessentities.Provider) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) ThreadPools(org.ovirt.engine.core.utils.threadpool.ThreadPools) TimeUnit(java.util.concurrent.TimeUnit) Inject(javax.inject.Inject) ActionType(org.ovirt.engine.core.common.action.ActionType) List(java.util.List) BackendInternal(org.ovirt.engine.core.bll.interfaces.BackendInternal) PostConstruct(javax.annotation.PostConstruct) ProviderType(org.ovirt.engine.core.common.businessentities.ProviderType) ApplicationScoped(javax.enterprise.context.ApplicationScoped) BackendService(org.ovirt.engine.core.common.BackendService) IdParameters(org.ovirt.engine.core.common.action.IdParameters) ManagedScheduledExecutorService(javax.enterprise.concurrent.ManagedScheduledExecutorService) Config(org.ovirt.engine.core.common.config.Config) IdParameters(org.ovirt.engine.core.common.action.IdParameters) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Aggregations

OpenstackNetworkProviderProperties (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)14 AgentConfiguration (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.AgentConfiguration)4 Provider (org.ovirt.engine.core.common.businessentities.Provider)3 AdditionalProperties (org.ovirt.engine.core.common.businessentities.Provider.AdditionalProperties)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)2 OpenStackImageProviderProperties (org.ovirt.engine.core.common.businessentities.OpenStackImageProviderProperties)2 MessagingConfiguration (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.MessagingConfiguration)2 OpenStackVolumeProviderProperties (org.ovirt.engine.core.common.businessentities.storage.OpenStackVolumeProviderProperties)2 GroupedListModelListBox (org.ovirt.engine.ui.common.widget.editor.GroupedListModelListBox)2 EntityModelCheckBoxEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)2 EntityModelRadioButtonEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor)2 EnumRenderer (org.ovirt.engine.ui.common.widget.renderer.EnumRenderer)2 NameRenderer (org.ovirt.engine.ui.common.widget.renderer.NameRenderer)2 AbstractRenderer (com.google.gwt.text.shared.AbstractRenderer)1 RadioButton (com.google.gwt.user.client.ui.RadioButton)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 TimeUnit (java.util.concurrent.TimeUnit)1