added relation with director to extract pg vip etc.
This commit is contained in:
parent
be51b8957c
commit
64336feb91
12
config.yaml
12
config.yaml
|
@ -21,18 +21,6 @@ options:
|
|||
type: string
|
||||
description: |
|
||||
Provide the version of networking-plumgrid package that needs to be installed
|
||||
plumgrid-username:
|
||||
default: plumgrid
|
||||
type: string
|
||||
description: Username to access PLUMgrid Director
|
||||
plumgrid-password:
|
||||
default: plumgrid
|
||||
type: string
|
||||
description: Password to access PLUMgrid Director
|
||||
plumgrid-virtual-ip:
|
||||
default: 192.168.100.250
|
||||
type: string
|
||||
description: IP address of PLUMgrid Director
|
||||
hardware-vendor-name:
|
||||
type: string
|
||||
default: vendor_name
|
||||
|
|
|
@ -29,7 +29,28 @@ def _edge_settings():
|
|||
return ctxt
|
||||
|
||||
|
||||
def _plumgrid_configs():
|
||||
'''
|
||||
Inspects plumgrid-director relation to get plumgrid virtup ip, username and password.
|
||||
'''
|
||||
ctxt = {}
|
||||
for rid in relation_ids('plumgrid-configs'):
|
||||
for unit in related_units(rid):
|
||||
rdata = relation_get(rid=rid, unit=unit)
|
||||
if 'plumgrid_virtual_ip' in rdata:
|
||||
ctxt['plumgrid_virtual_ip'] = \
|
||||
rdata['plumgrid_virtual_ip']
|
||||
ctxt['plumgrid_username'] = \
|
||||
rdata['plumgrid_username']
|
||||
ctxt['plumgrid_password'] = \
|
||||
rdata['plumgrid_password']
|
||||
return ctxt
|
||||
|
||||
|
||||
def _identity_context():
|
||||
'''
|
||||
Inspects keystone relation to get keystone credentials.
|
||||
'''
|
||||
ctxs = [{
|
||||
'auth_host': gethostbyname(hostname),
|
||||
'auth_port': relation_get('service_port', unit, rid),
|
||||
|
@ -87,10 +108,6 @@ class NeutronPGPluginContext(context.NeutronContext):
|
|||
|
||||
conf = config()
|
||||
enable_metadata = conf['enable-metadata']
|
||||
# (TODO) get this information from director
|
||||
pg_ctxt['pg_username'] = conf['plumgrid-username']
|
||||
pg_ctxt['pg_password'] = conf['plumgrid-password']
|
||||
pg_ctxt['virtual_ip'] = conf['plumgrid-virtual-ip']
|
||||
pg_ctxt['hardware_vendor_name'] = config('hardware-vendor-name')
|
||||
pg_ctxt['switch_username'] = config('switch-username')
|
||||
pg_ctxt['switch_password'] = config('switch-password')
|
||||
|
@ -114,6 +131,10 @@ class NeutronPGPluginContext(context.NeutronContext):
|
|||
pg_ctxt['service_protocol'] = identity_context['service_protocol']
|
||||
pg_ctxt['auth_port'] = identity_context['auth_port']
|
||||
pg_ctxt['auth_host'] = identity_context['auth_host']
|
||||
plumgrid_configs = _plumgrid_configs()
|
||||
if plumgrid_configs:
|
||||
pg_ctxt['pg_username'] = plumgrid_configs['plumgrid_username']
|
||||
pg_ctxt['pg_password'] = plumgrid_configs['plumgrid_password']
|
||||
pg_ctxt['virtual_ip'] = plumgrid_configs['plumgrid_virtual_ip']
|
||||
print pg_ctxt
|
||||
|
||||
return pg_ctxt
|
||||
|
|
|
@ -95,6 +95,13 @@ def neutron_plugin_joined():
|
|||
set_neutron_relation()
|
||||
|
||||
|
||||
@hooks.hook("plumgrid-configs-relation-changed")
|
||||
@hooks.hook("plumgrid-configs-relation-broken")
|
||||
@restart_on_change(restart_map())
|
||||
def plumgrid_configs_relation():
|
||||
CONFIGS.write_all()
|
||||
|
||||
|
||||
@hooks.hook("identity-admin-relation-changed")
|
||||
@hooks.hook("identity-admin-relation-broken")
|
||||
@restart_on_change(restart_map())
|
||||
|
|
|
@ -27,5 +27,9 @@ requires:
|
|||
container:
|
||||
interface: neutron-plugin-api
|
||||
scope: container
|
||||
plumgrid:
|
||||
interface: plumgrid
|
||||
identity-admin:
|
||||
interface: keystone-admin
|
||||
plumgrid-configs:
|
||||
interface: plumgrid-configs
|
||||
|
|
Loading…
Reference in New Issue