Switch from using a plugin to baking an nova amqp relation into the charm

This commit is contained in:
Liam Young
2014-06-06 12:24:09 +00:00
parent ed6ddbad2d
commit 03a9ab2fcd
7 changed files with 12 additions and 33 deletions

View File

@@ -245,8 +245,9 @@ class IdentityServiceContext(OSContextGenerator):
class AMQPContext(OSContextGenerator):
interfaces = ['amqp']
def __init__(self, ssl_dir=None):
def __init__(self, rel_name='amqp', ssl_dir=None):
self.ssl_dir = ssl_dir
self.rel_name = rel_name
def __call__(self):
log('Generating template context for amqp')
@@ -259,7 +260,7 @@ class AMQPContext(OSContextGenerator):
'Missing required charm config options: %s.' % e)
raise OSContextError
ctxt = {}
for rid in relation_ids('amqp'):
for rid in relation_ids(self.rel_name):
ha_vip_only = False
for unit in related_units(rid):
if relation_get('clustered', rid=rid, unit=unit):

View File

@@ -1 +0,0 @@
quantum_hooks.py

View File

@@ -1 +0,0 @@
quantum_hooks.py

View File

@@ -1 +0,0 @@
quantum_hooks.py

View File

@@ -1,6 +1,5 @@
#!/usr/bin/python
import uuid
from base64 import b64decode
from charmhelpers.core.hookenv import (
@@ -48,8 +47,6 @@ from quantum_utils import (
stop_services
)
from charmhelpers.contrib.openstack import context
hooks = Hooks()
CONFIGS = register_configs()
@@ -178,14 +175,6 @@ 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)

View File

@@ -8,7 +8,7 @@ from charmhelpers.core.hookenv import (
config,
relations_of_type,
unit_private_ip,
is_relation_made
is_relation_made,
)
from charmhelpers.fetch import (
apt_upgrade,
@@ -177,8 +177,7 @@ NOVA_CONF = "/etc/nova/nova.conf"
NOVA_CONFIG_FILES = {
NOVA_CONF: {
'hook_contexts': [context.AMQPContext(ssl_dir=NOVA_CONF_DIR),
context.SharedDBContext(ssl_dir=NOVA_CONF_DIR),
'hook_contexts': [context.SharedDBContext(ssl_dir=NOVA_CONF_DIR),
context.PostgresqlDBContext(),
NetworkServiceContext(),
QuantumGatewayContext(),
@@ -341,17 +340,11 @@ 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)
if is_relation_made('amqp-nova'):
amqp_nova_ctxt = context.AMQPContext(ssl_dir=NOVA_CONF_DIR, rel_name='amqp-nova')
else:
amqp_nova_ctxt = context.AMQPContext(ssl_dir=NOVA_CONF_DIR, rel_name='amqp')
CONFIG_FILES[name][plugin][NOVA_CONF]['hook_contexts'].append(amqp_nova_ctxt)
for conf in CONFIG_FILES[name][plugin]:
configs.register(conf,
CONFIG_FILES[name][plugin][conf]['hook_contexts'])

View File

@@ -25,9 +25,8 @@ requires:
interface: pgsql
amqp:
interface: rabbitmq
neutron-plugin:
interface: neutron-plugin
scope: container
amqp-nova:
interface: rabbitmq
peers:
cluster:
interface: quantum-gateway-ha