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;
}
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);
}
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;
}
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);
}
}
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));
});
}
Aggregations