From 2e78911e5c57794490311ab35fd94eb263f6c7c7 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Tue, 25 Aug 2015 12:40:46 +0200 Subject: [PATCH] Fix neutron conf for compute and nova_neutron resource Signed-off-by: Bogdan Dobrelya --- example-puppet.py | 12 ++++++++++ resources/nova_neutron_puppet/README.md | 6 +++++ resources/nova_neutron_puppet/actions/run.pp | 13 ++++++---- resources/nova_neutron_puppet/meta.yaml | 25 +++++++++++++++----- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/example-puppet.py b/example-puppet.py index c1c17bb2..1afe8d31 100644 --- a/example-puppet.py +++ b/example-puppet.py @@ -475,8 +475,20 @@ def setup_resources(): # NOTE(bogdando): changes nova config, so should notify nova compute service nova_compute_libvirt_puppet = vr.create('nova_compute_libvirt_puppet', 'resources/nova_compute_libvirt_puppet', {})[0] signals.connect(node2, nova_compute_libvirt_puppet) + # compute configuration for neutron, use http auth/endpoint protocols, keystone v2 auth hardcoded for the resource nova_neutron_puppet = vr.create('nova_neutron_puppet', 'resources/nova_neutron_puppet', {})[0] signals.connect(node2, nova_neutron_puppet) + signals.connect(neutron_server_puppet, nova_neutron_puppet, { + 'auth_password': 'neutron_admin_password', + 'auth_user': 'neutron_admin_username', + 'auth_type': 'neutron_auth_strategy', + 'auth_host': 'auth_host', 'auth_port': 'auth_port', + 'auth_protocol': 'auth_protocol', + }) + signals.connect(neutron_keystone_service_endpoint, nova_neutron_puppet, { + 'internal_ip':'neutron_endpoint_host', + 'internal_port':'neutron_endpoint_port', + }) # signals.connect(keystone_puppet, nova_network_puppet, {'ip': 'keystone_host', 'port': 'keystone_port'}) # signals.connect(keystone_puppet, nova_keystone_service_endpoint, {'ip': 'keystone_host', 'admin_port': 'keystone_port', 'admin_token': 'admin_token'}) diff --git a/resources/nova_neutron_puppet/README.md b/resources/nova_neutron_puppet/README.md index 1824d2af..fd438068 100644 --- a/resources/nova_neutron_puppet/README.md +++ b/resources/nova_neutron_puppet/README.md @@ -32,6 +32,9 @@ source https://github.com/openstack/puppet-nova/blob/5.1.0/manifests/network/neu ``neutron_url`` (optional) URL for connecting to the Neutron networking service. Defaults to 'http://127.0.0.1:9696' + Note: for this resource it is decomposed to the + 'neutron_endpoint_host', 'neutron_endpoint_port', 'neutron_endpoint_protocol' inputs + due to implementation limitations ``neutron_url_timeout`` (optional) Timeout value for connecting to neutron in seconds. @@ -73,6 +76,9 @@ source https://github.com/openstack/puppet-nova/blob/5.1.0/manifests/network/neu This is the Identity (keystone) admin API server IP and port value, and not the Identity service API IP and port. Defaults to 'http://127.0.0.1:35357/v2.0' + Note: for this resource it is decomposed to the + 'auth_host', 'auth_port', 'auth_protocol' inputs + due to implementation limitations ``network_api_class`` (optional) The full class name of the network API class. diff --git a/resources/nova_neutron_puppet/actions/run.pp b/resources/nova_neutron_puppet/actions/run.pp index 173f13da..4a0db5b8 100644 --- a/resources/nova_neutron_puppet/actions/run.pp +++ b/resources/nova_neutron_puppet/actions/run.pp @@ -1,16 +1,21 @@ $resource = hiera($::resource_name) +$auth_host = $resource['input']['auth_host']['value'] +$auth_port = $resource['input']['auth_port']['value'] +$auth_protocol = $resource['input']['auth_protocol']['value'] +$neutron_endpoint_host = $resource['input']['neutron_endpoint_host']['value'] +$neutron_endpoint_port = $resource['input']['neutron_endpoint_port']['value'] +$neutron_endpoint_protocol = $resource['input']['neutron_endpoint_protocol']['value'] + $libvirt_vif_driver = $resource['input']['libvirt_vif_driver']['value'] $force_snat_range = $resource['input']['force_snat_range']['value'] $neutron_admin_password = $resource['input']['neutron_admin_password']['value'] $neutron_auth_strategy = $resource['input']['neutron_auth_strategy']['value'] -$neutron_url = $resource['input']['neutron_url']['value'] $neutron_url_timeout = $resource['input']['neutron_url_timeout']['value'] $neutron_admin_tenant_name = $resource['input']['neutron_admin_tenant_name']['value'] $neutron_default_tenant_id = $resource['input']['neutron_default_tenant_id']['value'] $neutron_region_name = $resource['input']['neutron_region_name']['value'] $neutron_admin_username = $resource['input']['neutron_admin_username']['value'] -$neutron_admin_auth_url = $resource['input']['neutron_admin_auth_url']['value'] $neutron_ovs_bridge = $resource['input']['neutron_ovs_bridge']['value'] $neutron_extension_sync_interval = $resource['input']['neutron_extension_sync_interval']['value'] $neutron_ca_certificates_file = $resource['input']['neutron_ca_certificates_file']['value'] @@ -30,13 +35,13 @@ class { 'nova::compute::neutron': class { 'nova::network::neutron': neutron_admin_password => $neutron_admin_password, neutron_auth_strategy => $neutron_auth_strategy, - neutron_url => $neutron_url, + neutron_url => "${neutron_endpoint_protocol}://${neutron_endpoint_host}:${neutron_endpoint_port}", neutron_url_timeout => $neutron_url_timeout, neutron_admin_tenant_name => $neutron_admin_tenant_name, neutron_default_tenant_id => $neutron_default_tenant_id, neutron_region_name => $neutron_region_name, neutron_admin_username => $neutron_admin_username, - neutron_admin_auth_url => $neutron_admin_auth_url, + neutron_admin_auth_url => "${auth_protocol}://${auth_host}:${auth_port}/v2.0", neutron_ovs_bridge => $neutron_ovs_bridge, neutron_extension_sync_interval => $neutron_extension_sync_interval, neutron_ca_certificates_file => $neutron_ca_certificates_file, diff --git a/resources/nova_neutron_puppet/meta.yaml b/resources/nova_neutron_puppet/meta.yaml index f8afae15..a3e7a111 100644 --- a/resources/nova_neutron_puppet/meta.yaml +++ b/resources/nova_neutron_puppet/meta.yaml @@ -3,6 +3,25 @@ handler: puppet puppet_module: nova version: 1.0.0 input: + auth_host: + schema: str + value: 'localhost' + auth_port: + schema: int + value: 35357 + auth_protocol: + schema: str + value: 'http' + neutron_endpoint_host: + schema: str + value: 'localhost' + neutron_endpoint_port: + schema: int + value: 9696 + neutron_endpoint_protocol: + schema: str + value: 'http' + libvirt_vif_driver: schema: str value: 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver' @@ -15,9 +34,6 @@ input: neutron_auth_strategy: schema: str value: 'keystone' - neutron_url: - schema: str - value: 'http://127.0.0.1:9696' neutron_url_timeout: schema: int value: 30 @@ -33,9 +49,6 @@ input: neutron_admin_username: schema: str value: 'neutron' - neutron_admin_auth_url: - schema: str - value: 'http://127.0.0.1:35357/v2.0' neutron_ovs_bridge: schema: str value: 'br-int'