[hopem,r=jamespage]
Fixes n-api context.
This commit is contained in:
commit
97ff044adb
@ -129,6 +129,25 @@ class NeutronCCContext(context.NeutronContext):
|
|||||||
def _save_flag_file(self):
|
def _save_flag_file(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def get_neutron_api_rel_settings(self):
|
||||||
|
settings = {}
|
||||||
|
for rid in relation_ids('neutron-api'):
|
||||||
|
for unit in related_units(rid):
|
||||||
|
rdata = relation_get(rid=rid, unit=unit)
|
||||||
|
cell_type = rdata.get('cell_type')
|
||||||
|
settings['nova_url'] = rdata.get('nova_url')
|
||||||
|
settings['restart_trigger'] = rdata.get('restart_trigger')
|
||||||
|
# If there are multiple nova-cloud-controllers joined to this
|
||||||
|
# service in a cell deployment then ignore the non-api cell
|
||||||
|
# ones
|
||||||
|
if cell_type and not cell_type == "api":
|
||||||
|
continue
|
||||||
|
|
||||||
|
if settings['nova_url']:
|
||||||
|
return settings
|
||||||
|
|
||||||
|
return settings
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
from neutron_api_utils import api_port
|
from neutron_api_utils import api_port
|
||||||
ctxt = super(NeutronCCContext, self).__call__()
|
ctxt = super(NeutronCCContext, self).__call__()
|
||||||
@ -170,19 +189,9 @@ class NeutronCCContext(context.NeutronContext):
|
|||||||
ctxt['quota_router'] = config('quota-router')
|
ctxt['quota_router'] = config('quota-router')
|
||||||
ctxt['quota_floatingip'] = config('quota-floatingip')
|
ctxt['quota_floatingip'] = config('quota-floatingip')
|
||||||
|
|
||||||
for rid in relation_ids('neutron-api'):
|
n_api_settings = self.get_neutron_api_rel_settings()
|
||||||
for unit in related_units(rid):
|
if n_api_settings:
|
||||||
rdata = relation_get(rid=rid, unit=unit)
|
ctxt.update(n_api_settings)
|
||||||
cell_type = rdata.get('cell_type')
|
|
||||||
ctxt['nova_url'] = rdata.get('nova_url')
|
|
||||||
ctxt['restart_trigger'] = rdata.get('restart_trigger')
|
|
||||||
# If there are multiple nova-cloud-controllers joined to this
|
|
||||||
# service in a cell deployment then ignore the non-api cell
|
|
||||||
# ones
|
|
||||||
if cell_type and not cell_type == "api":
|
|
||||||
continue
|
|
||||||
if ctxt['nova_url']:
|
|
||||||
return ctxt
|
|
||||||
|
|
||||||
vlan_ranges = config('vlan-ranges')
|
vlan_ranges = config('vlan-ranges')
|
||||||
vlan_range_mappings = parse_vlan_range_mappings(vlan_ranges)
|
vlan_range_mappings = parse_vlan_range_mappings(vlan_ranges)
|
||||||
|
Loading…
Reference in New Issue
Block a user