Restore management of neutron.conf to plugin
This commit is contained in:
parent
2440166014
commit
c8e783883f
@ -1,6 +1,6 @@
|
|||||||
options:
|
options:
|
||||||
rabbit-user:
|
rabbit-user:
|
||||||
default: nova
|
default: neutron
|
||||||
type: string
|
type: string
|
||||||
description: Username used to access rabbitmq queue
|
description: Username used to access rabbitmq queue
|
||||||
rabbit-vhost:
|
rabbit-vhost:
|
||||||
|
1
hooks/amqp-relation-broken
Symbolic link
1
hooks/amqp-relation-broken
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
neutron_ovs_hooks.py
|
1
hooks/amqp-relation-changed
Symbolic link
1
hooks/amqp-relation-changed
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
neutron_ovs_hooks.py
|
1
hooks/amqp-relation-departed
Symbolic link
1
hooks/amqp-relation-departed
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
neutron_ovs_hooks.py
|
1
hooks/amqp-relation-joined
Symbolic link
1
hooks/amqp-relation-joined
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
neutron_ovs_hooks.py
|
@ -487,10 +487,6 @@ class NeutronContext(OSContextGenerator):
|
|||||||
def plugin(self):
|
def plugin(self):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
|
||||||
def save_nova_flag(self):
|
|
||||||
return True
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def network_manager(self):
|
def network_manager(self):
|
||||||
return None
|
return None
|
||||||
@ -582,8 +578,7 @@ class NeutronContext(OSContextGenerator):
|
|||||||
flags = config_flags_parser(alchemy_flags)
|
flags = config_flags_parser(alchemy_flags)
|
||||||
ctxt['neutron_alchemy_flags'] = flags
|
ctxt['neutron_alchemy_flags'] = flags
|
||||||
|
|
||||||
if self.save_nova_flag:
|
self._save_flag_file()
|
||||||
self._save_flag_file()
|
|
||||||
return ctxt
|
return ctxt
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,10 +38,6 @@ class OVSPluginContext(context.NeutronContext):
|
|||||||
def network_manager(self):
|
def network_manager(self):
|
||||||
return 'neutron'
|
return 'neutron'
|
||||||
|
|
||||||
@property
|
|
||||||
def save_nova_flag(self):
|
|
||||||
return False
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def neutron_security_groups(self):
|
def neutron_security_groups(self):
|
||||||
return _neutron_security_groups()
|
return _neutron_security_groups()
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import uuid
|
|
||||||
import sys
|
import sys
|
||||||
import json
|
|
||||||
|
|
||||||
from charmhelpers.core.hookenv import (
|
from charmhelpers.core.hookenv import (
|
||||||
Hooks,
|
Hooks,
|
||||||
UnregisteredHookError,
|
UnregisteredHookError,
|
||||||
|
config,
|
||||||
log,
|
log,
|
||||||
relation_set,
|
relation_set,
|
||||||
relation_ids,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from charmhelpers.core.host import (
|
from charmhelpers.core.host import (
|
||||||
@ -23,7 +22,7 @@ from neutron_ovs_utils import (
|
|||||||
determine_packages,
|
determine_packages,
|
||||||
register_configs,
|
register_configs,
|
||||||
restart_map,
|
restart_map,
|
||||||
NEUTRON_SETTINGS,
|
NEUTRON_CONF,
|
||||||
)
|
)
|
||||||
|
|
||||||
hooks = Hooks()
|
hooks = Hooks()
|
||||||
@ -35,33 +34,31 @@ def install():
|
|||||||
apt_update()
|
apt_update()
|
||||||
apt_install(determine_packages(), fatal=True)
|
apt_install(determine_packages(), fatal=True)
|
||||||
|
|
||||||
@hooks.hook('config-changed')
|
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
|
@hooks.hook('config-changed')
|
||||||
def config_changed():
|
def config_changed():
|
||||||
CONFIGS.write_all()
|
CONFIGS.write_all()
|
||||||
[neutron_plugin_relation_joined(rid) for rid in relation_ids('neutron-plugin')]
|
|
||||||
|
|
||||||
@hooks.hook('neutron-plugin-relation-joined')
|
|
||||||
def neutron_plugin_relation_joined(remote_restart=True):
|
|
||||||
if remote_restart:
|
|
||||||
comment = ('restart', 'Restart Trigger: ' + str(uuid.uuid4()))
|
|
||||||
for conf in NEUTRON_SETTINGS['neutron']:
|
|
||||||
if 'sections' in NEUTRON_SETTINGS['neutron'][conf] and \
|
|
||||||
'COMMENT' in NEUTRON_SETTINGS['neutron'][conf]['sections']:
|
|
||||||
NEUTRON_SETTINGS['neutron'][conf]['sections']['COMMENT'].append(comment)
|
|
||||||
relation_set(subordinate_configuration=json.dumps(NEUTRON_SETTINGS))
|
|
||||||
|
|
||||||
@hooks.hook('neutron-plugin-relation-changed')
|
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
def neutron_plugin_relation_changed(remote_restart=True):
|
@hooks.hook('neutron-plugin-relation-changed')
|
||||||
|
def neutron_plugin_relation_changed():
|
||||||
CONFIGS.write_all()
|
CONFIGS.write_all()
|
||||||
if remote_restart:
|
|
||||||
comment = ('restart', 'Restart Trigger: ' + str(uuid.uuid4()))
|
@hooks.hook('amqp-relation-joined')
|
||||||
for conf in NEUTRON_SETTINGS['neutron']:
|
def amqp_joined(relation_id=None):
|
||||||
if 'sections' in NEUTRON_SETTINGS['neutron'][conf] and \
|
relation_set(relation_id=relation_id,
|
||||||
'COMMENT' in NEUTRON_SETTINGS['neutron'][conf]['sections']:
|
username=config('rabbit-user'),
|
||||||
NEUTRON_SETTINGS['neutron'][conf]['sections']['COMMENT'].append(comment)
|
vhost=config('rabbit-vhost'))
|
||||||
relation_set(subordinate_configuration=json.dumps(NEUTRON_SETTINGS))
|
|
||||||
|
|
||||||
|
@hooks.hook('amqp-relation-changed')
|
||||||
|
@hooks.hook('amqp-relation-departed')
|
||||||
|
@restart_on_change(restart_map())
|
||||||
|
def amqp_changed():
|
||||||
|
if 'amqp' not in CONFIGS.complete_contexts():
|
||||||
|
log('amqp relation incomplete. Peer not ready?')
|
||||||
|
return
|
||||||
|
CONFIGS.write(NEUTRON_CONF)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
|
@ -1,55 +1,32 @@
|
|||||||
from charmhelpers.contrib.openstack.neutron import neutron_plugin_attribute
|
from charmhelpers.contrib.openstack.neutron import neutron_plugin_attribute
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from charmhelpers.contrib.openstack import templating
|
|
||||||
|
from charmhelpers.contrib.openstack import context, templating
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from charmhelpers.contrib.openstack.utils import (
|
from charmhelpers.contrib.openstack.utils import (
|
||||||
os_release,
|
os_release,
|
||||||
)
|
)
|
||||||
import neutron_ovs_context
|
import neutron_ovs_context
|
||||||
|
from charmhelpers.core.hookenv import is_relation_made
|
||||||
|
|
||||||
NOVA_CONF_DIR = "/etc/nova"
|
NOVA_CONF_DIR = "/etc/nova"
|
||||||
NEUTRON_CONF_DIR = "/etc/neutron"
|
NEUTRON_CONF_DIR = "/etc/neutron"
|
||||||
NEUTRON_CONF = "%s/neutron.conf" % NEUTRON_CONF_DIR
|
NEUTRON_CONF = '%s/neutron.conf' % NEUTRON_CONF_DIR
|
||||||
ML2_CONF = '%s/plugins/ml2/ml2_conf.ini' % NEUTRON_CONF_DIR
|
|
||||||
NEUTRON_DEFAULT = '/etc/default/neutron-server'
|
NEUTRON_DEFAULT = '/etc/default/neutron-server'
|
||||||
|
ML2_CONF = '%s/plugins/ml2/ml2_conf.ini' % NEUTRON_CONF_DIR
|
||||||
|
|
||||||
BASE_RESOURCE_MAP = OrderedDict([
|
BASE_RESOURCE_MAP = OrderedDict([
|
||||||
|
(NEUTRON_CONF, {
|
||||||
|
'services': ['neutron-plugin-openvswitch-agent'],
|
||||||
|
'contexts': [neutron_ovs_context.OVSPluginContext(),
|
||||||
|
context.AMQPContext()],
|
||||||
|
}),
|
||||||
(ML2_CONF, {
|
(ML2_CONF, {
|
||||||
'services': ['neutron-plugin-openvswitch-agent'],
|
'services': ['neutron-plugin-openvswitch-agent'],
|
||||||
'contexts': [neutron_ovs_context.OVSPluginContext()],
|
'contexts': [neutron_ovs_context.OVSPluginContext()],
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
TEMPLATES = 'templates/'
|
TEMPLATES = 'templates/'
|
||||||
NEUTRON_SERVICE_PLUGINS=['neutron.services.l3_router.l3_router_plugin.L3RouterPlugin',
|
|
||||||
'neutron.services.firewall.fwaas_plugin.FirewallPlugin',
|
|
||||||
'neutron.services.loadbalancer.plugin.LoadBalancerPlugin',
|
|
||||||
'neutron.services.vpn.plugin.VPNDriverPlugin',
|
|
||||||
'neutron.services.metering.metering_plugin.MeteringPlugin']
|
|
||||||
NEUTRON_SETTINGS = {
|
|
||||||
"neutron": {
|
|
||||||
NEUTRON_CONF: {
|
|
||||||
"sections": {
|
|
||||||
"DEFAULT": [
|
|
||||||
('core_plugin', 'neutron.plugins.ml2.plugin.Ml2Plugin'),
|
|
||||||
('service_plugins', ','.join(NEUTRON_SERVICE_PLUGINS)),
|
|
||||||
],
|
|
||||||
"COMMENT": [
|
|
||||||
('comment1', 'Warning: some settings controlled by subordinate neutron-openvswitch'),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
NEUTRON_DEFAULT: {
|
|
||||||
"sections": {
|
|
||||||
"DEFAULT": [
|
|
||||||
('NEUTRON_PLUGIN_CONFIG', ML2_CONF),
|
|
||||||
],
|
|
||||||
"COMMENT": [
|
|
||||||
('comment1', 'Warning: some settings controlled by subordinate neutron-openvswitch'),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def determine_packages():
|
def determine_packages():
|
||||||
ovs_pkgs = []
|
ovs_pkgs = []
|
||||||
@ -61,7 +38,7 @@ def determine_packages():
|
|||||||
return set(ovs_pkgs)
|
return set(ovs_pkgs)
|
||||||
|
|
||||||
def register_configs(release=None):
|
def register_configs(release=None):
|
||||||
release = release or os_release('neutron-common')
|
release = release or os_release('nova-common')
|
||||||
configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
|
configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
|
||||||
openstack_release=release)
|
openstack_release=release)
|
||||||
for cfg, rscs in resource_map().iteritems():
|
for cfg, rscs in resource_map().iteritems():
|
||||||
|
@ -11,6 +11,8 @@ provides:
|
|||||||
interface: neutron-plugin
|
interface: neutron-plugin
|
||||||
scope: container
|
scope: container
|
||||||
requires:
|
requires:
|
||||||
|
amqp:
|
||||||
|
interface: rabbitmq
|
||||||
container:
|
container:
|
||||||
interface: juju-info
|
interface: juju-info
|
||||||
scope: container
|
scope: container
|
||||||
|
34
templates/havana/neutron.conf
Normal file
34
templates/havana/neutron.conf
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# grizzly
|
||||||
|
###############################################################################
|
||||||
|
# [ WARNING ]
|
||||||
|
# Configuration file maintained by Juju. Local changes may be overwritten.
|
||||||
|
###############################################################################
|
||||||
|
[DEFAULT]
|
||||||
|
state_path = /var/lib/neutron
|
||||||
|
lock_path = $state_path/lock
|
||||||
|
bind_host = 0.0.0.0
|
||||||
|
bind_port = 9696
|
||||||
|
|
||||||
|
{% if core_plugin -%}
|
||||||
|
core_plugin = {{ core_plugin }}
|
||||||
|
{% endif -%}
|
||||||
|
|
||||||
|
api_paste_config = /etc/neutron/api-paste.ini
|
||||||
|
auth_strategy = keystone
|
||||||
|
notification_driver = neutron.openstack.common.notifier.rpc_notifier
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
|
default_notification_level = INFO
|
||||||
|
notification_topics = notifications
|
||||||
|
|
||||||
|
{% include "parts/rabbitmq" %}
|
||||||
|
|
||||||
|
[QUOTAS]
|
||||||
|
|
||||||
|
[DEFAULT_SERVICETYPE]
|
||||||
|
|
||||||
|
[AGENT]
|
||||||
|
root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf
|
||||||
|
|
||||||
|
[keystone_authtoken]
|
||||||
|
signing_dir = /var/lib/neutron/keystone-signing
|
||||||
|
|
@ -2,7 +2,6 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# [ WARNING ]
|
# [ WARNING ]
|
||||||
# Configuration file maintained by Juju. Local changes may be overwritten.
|
# Configuration file maintained by Juju. Local changes may be overwritten.
|
||||||
# Config from neutron-openvswitch plugin
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
[ml2]
|
[ml2]
|
||||||
type_drivers = gre,vxlan
|
type_drivers = gre,vxlan
|
||||||
|
Loading…
Reference in New Issue
Block a user