Add support for plugins
This commit is contained in:
1
hooks/neutron-plugin-relation-changed
Symbolic link
1
hooks/neutron-plugin-relation-changed
Symbolic link
@@ -0,0 +1 @@
|
||||
quantum_hooks.py
|
||||
1
hooks/neutron-plugin-relation-departed
Symbolic link
1
hooks/neutron-plugin-relation-departed
Symbolic link
@@ -0,0 +1 @@
|
||||
quantum_hooks.py
|
||||
1
hooks/neutron-plugin-relation-joined
Symbolic link
1
hooks/neutron-plugin-relation-joined
Symbolic link
@@ -0,0 +1 @@
|
||||
quantum_hooks.py
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import uuid
|
||||
from base64 import b64decode
|
||||
|
||||
from charmhelpers.core.hookenv import (
|
||||
@@ -47,6 +48,8 @@ from quantum_utils import (
|
||||
stop_services
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.openstack import context
|
||||
|
||||
hooks = Hooks()
|
||||
CONFIGS = register_configs()
|
||||
|
||||
@@ -175,6 +178,14 @@ def cluster_departed():
|
||||
def stop():
|
||||
stop_services()
|
||||
|
||||
@hooks.hook('neutron-plugin-relation-joined')
|
||||
def neutron_plugin_relation_joined(rid=None, remote_restart=False):
|
||||
amqp_ctxt = context.AMQPContext()
|
||||
rel_settings = amqp_ctxt()
|
||||
if remote_restart:
|
||||
rel_settings['restart_trigger'] = str(uuid.uuid4())
|
||||
relation_set(relation_id=rid, **rel_settings)
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
hooks.execute(sys.argv)
|
||||
|
||||
@@ -7,7 +7,8 @@ from charmhelpers.core.hookenv import (
|
||||
log,
|
||||
config,
|
||||
relations_of_type,
|
||||
unit_private_ip
|
||||
unit_private_ip,
|
||||
is_relation_made
|
||||
)
|
||||
from charmhelpers.fetch import (
|
||||
apt_upgrade,
|
||||
@@ -340,6 +341,17 @@ def register_configs():
|
||||
if drop_config in CONFIG_FILES[name][plugin]:
|
||||
CONFIG_FILES[name][plugin].pop(drop_config)
|
||||
|
||||
# Hardcoded list of configs which are managed by plugin subordinate if
|
||||
# available. Any new plugin conf should go into a subordinate list so
|
||||
# this list should never change
|
||||
if is_relation_made('neutron-plugin'):
|
||||
drop_configs = [NEUTRON_ML2_PLUGIN_CONF, NEUTRON_OVS_PLUGIN_CONF,
|
||||
NEUTRON_CONF, NEUTRON_NVP_PLUGIN_CONF]
|
||||
for l_plugin in NEUTRON_PLUGIN_CONF:
|
||||
for drop_config in drop_configs:
|
||||
if drop_config in CONFIG_FILES['neutron'][l_plugin]:
|
||||
CONFIG_FILES[name][l_plugin].pop(drop_config)
|
||||
|
||||
for conf in CONFIG_FILES[name][plugin]:
|
||||
configs.register(conf,
|
||||
CONFIG_FILES[name][plugin][conf]['hook_contexts'])
|
||||
|
||||
@@ -25,6 +25,9 @@ requires:
|
||||
interface: pgsql
|
||||
amqp:
|
||||
interface: rabbitmq
|
||||
neutron-plugin:
|
||||
interface: neutron-plugin
|
||||
scope: container
|
||||
peers:
|
||||
cluster:
|
||||
interface: quantum-gateway-ha
|
||||
|
||||
Reference in New Issue
Block a user