From 6dac953777a2536aa6173d1a91f001bef4d736c7 Mon Sep 17 00:00:00 2001 From: James Page Date: Fri, 27 Jun 2014 11:37:18 +0100 Subject: [PATCH] Add extra admin-network configuration --- config.yaml | 9 ++++++++- hooks/nova_cc_hooks.py | 6 +++++- hooks/nova_cc_utils.py | 21 +++++++++++++++------ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/config.yaml b/config.yaml index 6c81a8a9..40e2bb96 100644 --- a/config.yaml +++ b/config.yaml @@ -167,13 +167,20 @@ options: # end of NVP/NSX configuration # Network configuration options # by default all access is over 'private-address' + os-admin-network: + type: string + description: | + The IP address and netmask of the OpenStack Admin network (e.g., + 192.168.0.0/24) + . + This network will be used for admin endpoints. os-internal-network: type: string description: | The IP address and netmask of the OpenStack Internal network (e.g., 192.168.0.0/24) . - This network will be used for admin and internal endpoints. + This network will be used for internal endpoints. os-public-network: type: string description: | diff --git a/hooks/nova_cc_hooks.py b/hooks/nova_cc_hooks.py index 823fa4d7..5635aea6 100755 --- a/hooks/nova_cc_hooks.py +++ b/hooks/nova_cc_hooks.py @@ -239,8 +239,12 @@ def identity_joined(rid=None): internal_url = canonical_url(CONFIGS, address=get_address_in_network(config('os-internal-network'), unit_get('private-address'))) + admin_url = canonical_url(CONFIGS, + address=get_address_in_network(config('os-admin-network'), + unit_get('private-address'))) relation_set(relation_id=rid, **determine_endpoints(public_url, - internal_url)) + internal_url, + admin_url)) @hooks.hook('identity-service-relation-changed') diff --git a/hooks/nova_cc_utils.py b/hooks/nova_cc_utils.py index b3e8da36..ec82d0ed 100644 --- a/hooks/nova_cc_utils.py +++ b/hooks/nova_cc_utils.py @@ -643,7 +643,7 @@ def ssh_compute_remove(public_key, user=None): _keys.write(keys) -def determine_endpoints(public_url, internal_url): +def determine_endpoints(public_url, internal_url, admin_url): '''Generates a dictionary containing all relevant endpoints to be passed to keystone as relation settings.''' region = config('region') @@ -654,42 +654,51 @@ def determine_endpoints(public_url, internal_url): (public_url, api_port('nova-api-os-compute'))) nova_internal_url = ('%s:%s/v2/$(tenant_id)s' % (internal_url, api_port('nova-api-os-compute'))) + nova_admin_url = ('%s:%s/v2/$(tenant_id)s' % + (admin_url, api_port('nova-api-os-compute'))) else: nova_public_url = ('%s:%s/v1.1/$(tenant_id)s' % (public_url, api_port('nova-api-os-compute'))) nova_internal_url = ('%s:%s/v1.1/$(tenant_id)s' % (internal_url, api_port('nova-api-os-compute'))) + nova_admin_url = ('%s:%s/v1.1/$(tenant_id)s' % + (admin_url, api_port('nova-api-os-compute'))) ec2_public_url = '%s:%s/services/Cloud' % (public_url, api_port('nova-api-ec2')) ec2_internal_url = '%s:%s/services/Cloud' % (internal_url, api_port('nova-api-ec2')) + ec2_admin_url = '%s:%s/services/Cloud' % (admin_url, api_port('nova-api-ec2')) nova_volume_public_url = ('%s:%s/v1/$(tenant_id)s' % (public_url, api_port('nova-api-os-compute'))) nova_volume_internal_url = ('%s:%s/v1/$(tenant_id)s' % (internal_url, api_port('nova-api-os-compute'))) + nova_volume_admin_url = ('%s:%s/v1/$(tenant_id)s' % + (admin_url, api_port('nova-api-os-compute'))) neutron_public_url = '%s:%s' % (public_url, api_port('neutron-server')) neutron_internal_url = '%s:%s' % (internal_url, api_port('neutron-server')) + neutron_admin_url = '%s:%s' % (admin_url, api_port('neutron-server')) s3_public_url = '%s:%s' % (public_url, api_port('nova-objectstore')) s3_internal_url = '%s:%s' % (internal_url, api_port('nova-objectstore')) + s3_admin_url = '%s:%s' % (admin_url, api_port('nova-objectstore')) # the base endpoints endpoints = { 'nova_service': 'nova', 'nova_region': region, 'nova_public_url': nova_public_url, - 'nova_admin_url': nova_internal_url, + 'nova_admin_url': nova_admin_url, 'nova_internal_url': nova_internal_url, 'ec2_service': 'ec2', 'ec2_region': region, 'ec2_public_url': ec2_public_url, - 'ec2_admin_url': ec2_internal_url, + 'ec2_admin_url': ec2_admin_url, 'ec2_internal_url': ec2_internal_url, 's3_service': 's3', 's3_region': region, 's3_public_url': s3_public_url, - 's3_admin_url': s3_internal_url, + 's3_admin_url': s3_admin_url, 's3_internal_url': s3_internal_url, } @@ -698,7 +707,7 @@ def determine_endpoints(public_url, internal_url): 'nova-volume_service': 'nova-volume', 'nova-volume_region': region, 'nova-volume_public_url': nova_volume_public_url, - 'nova-volume_admin_url': nova_volume_internal_url, + 'nova-volume_admin_url': nova_volume_admin_url, 'nova-volume_internal_url': nova_volume_internal_url, }) @@ -716,7 +725,7 @@ def determine_endpoints(public_url, internal_url): 'quantum_service': 'quantum', 'quantum_region': region, 'quantum_public_url': neutron_public_url, - 'quantum_admin_url': neutron_internal_url, + 'quantum_admin_url': neutron_admin_url, 'quantum_internal_url': neutron_internal_url, })