Search in sources :

Example 1 with TenantProviderProperties

use of org.ovirt.engine.core.common.businessentities.TenantProviderProperties 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)

Aggregations

OpenStackImageProviderProperties (org.ovirt.engine.core.common.businessentities.OpenStackImageProviderProperties)1 OpenstackNetworkProviderProperties (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)1 TenantProviderProperties (org.ovirt.engine.core.common.businessentities.TenantProviderProperties)1 OpenStackVolumeProviderProperties (org.ovirt.engine.core.common.businessentities.storage.OpenStackVolumeProviderProperties)1