[billy-olsen,r=] Use region information from nova-cloud-controller.
Use the region provided by in the cloud-compute relation in order to determine which region this node should be hosted in. This enables the os_region_name value to be set in appropriate services so that compute can properly access services in the same region. Closes-Bug: #1421105
This commit is contained in:
@@ -248,6 +248,14 @@ class CloudComputeContext(context.OSContextGenerator):
|
||||
rid=rid, unit=unit)
|
||||
return volume_service
|
||||
|
||||
@property
|
||||
def region(self):
|
||||
region = None
|
||||
for rid in relation_ids('cloud-compute'):
|
||||
for unit in related_units(rid):
|
||||
region = relation_get('region', rid=rid, unit=unit)
|
||||
return region
|
||||
|
||||
def flat_dhcp_context(self):
|
||||
ec2_host = None
|
||||
for rid in relation_ids('cloud-compute'):
|
||||
@@ -400,6 +408,11 @@ class CloudComputeContext(context.OSContextGenerator):
|
||||
|
||||
if self.restart_trigger():
|
||||
ctxt['restart_trigger'] = self.restart_trigger()
|
||||
|
||||
region = self.region
|
||||
if region:
|
||||
ctxt['region'] = region
|
||||
|
||||
return ctxt
|
||||
|
||||
|
||||
|
||||
@@ -113,6 +113,9 @@ network_device_mtu = {{ network_device_mtu }}
|
||||
|
||||
{% if volume_service -%}
|
||||
volume_api_class = nova.volume.cinder.API
|
||||
{% if region -%}
|
||||
os_region_name = {{ region }}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
|
||||
{% if user_config_flags -%}
|
||||
|
||||
@@ -167,3 +167,6 @@ live_migration_uri = {{ live_migration_uri }}
|
||||
{% if disk_cachemodes -%}
|
||||
disk_cachemodes = {{ disk_cachemodes }}
|
||||
{% endif -%}
|
||||
|
||||
{% include "parts/cinder" %}
|
||||
|
||||
|
||||
@@ -180,6 +180,8 @@ disk_cachemodes = {{ disk_cachemodes }}
|
||||
|
||||
{% include "section-rabbitmq-oslo" %}
|
||||
|
||||
{% include "parts/cinder" %}
|
||||
|
||||
[oslo_concurrency]
|
||||
lock_path=/var/lock/nova
|
||||
|
||||
|
||||
5
templates/parts/cinder
Normal file
5
templates/parts/cinder
Normal file
@@ -0,0 +1,5 @@
|
||||
{% if volume_service and volume_service == 'cinder' and region -%}
|
||||
[cinder]
|
||||
os_region_name = {{ region }}
|
||||
{% endif -%}
|
||||
|
||||
Reference in New Issue
Block a user