37
43
QuantumGatewayContext,
38
44
NetworkServiceContext,
40
QuantumSharedDBContext,
41
46
ExternalPortContext,
49
from copy import deepcopy
45
52
def valid_plugin():
46
53
return config('plugin') in CORE_PLUGIN[networking_name()]
55
QUANTUM_CONF_DIR = '/etc/quantum'
48
57
QUANTUM_OVS_PLUGIN_CONF = \
49
58
"/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini"
50
59
QUANTUM_NVP_PLUGIN_CONF = \
54
63
NVP: QUANTUM_NVP_PLUGIN_CONF
66
NEUTRON_CONF_DIR = '/etc/neutron'
57
68
NEUTRON_OVS_PLUGIN_CONF = \
58
69
"/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini"
70
NEUTRON_ML2_PLUGIN_CONF = \
71
"/etc/neutron/plugins/ml2/ml2_conf.ini"
59
72
NEUTRON_NVP_PLUGIN_CONF = \
60
73
"/etc/neutron/plugins/nicira/nvp.ini"
61
74
NEUTRON_PLUGIN_CONF = {
102
122
NEUTRON: NEUTRON_GATEWAY_PKGS,
106
OVS: ['openvswitch-datapath-dkms'],
111
126
def get_early_packages():
112
127
'''Return a list of package for pre-install based on configured plugin'''
113
if config('plugin') in EARLY_PACKAGES:
114
pkgs = EARLY_PACKAGES[config('plugin')]
128
if config('plugin') in [OVS]:
129
pkgs = determine_dkms_package()
124
139
def get_packages():
125
140
'''Return a list of packages for install based on the configured plugin'''
126
return GATEWAY_PKGS[networking_name()][config('plugin')]
141
packages = deepcopy(GATEWAY_PKGS[networking_name()][config('plugin')])
142
if (get_os_codename_install_source(config('openstack-origin'))
143
>= 'icehouse' and config('plugin') == 'ovs'):
144
# NOTE(jamespage) neutron-vpn-agent supercedes l3-agent for icehouse
145
packages.remove('neutron-l3-agent')
146
packages.append('neutron-vpn-agent')
129
150
def get_common_package():
145
166
NEUTRON_DHCP_AGENT_CONF = "/etc/neutron/dhcp_agent.ini"
146
167
NEUTRON_DNSMASQ_CONF = "/etc/neutron/dnsmasq.conf"
147
168
NEUTRON_METADATA_AGENT_CONF = "/etc/neutron/metadata_agent.ini"
169
NEUTRON_METERING_AGENT_CONF = "/etc/neutron/metering_agent.ini"
170
NEUTRON_LBAAS_AGENT_CONF = "/etc/neutron/lbaas_agent.ini"
171
NEUTRON_VPNAAS_AGENT_CONF = "/etc/neutron/vpn_agent.ini"
172
NEUTRON_FWAAS_CONF = "/etc/neutron/fwaas_driver.ini"
174
NOVA_CONF_DIR = '/etc/nova'
149
175
NOVA_CONF = "/etc/nova/nova.conf"
151
177
NOVA_CONFIG_FILES = {
153
'hook_contexts': [context.AMQPContext(),
154
QuantumSharedDBContext(),
179
'hook_contexts': [context.AMQPContext(ssl_dir=NOVA_CONF_DIR),
180
context.SharedDBContext(ssl_dir=NOVA_CONF_DIR),
181
context.PostgresqlDBContext(),
155
182
NetworkServiceContext(),
156
183
QuantumGatewayContext(),
157
184
SyslogContext()],
192
219
QUANTUM_OVS_CONFIG_FILES = {
194
'hook_contexts': [context.AMQPContext(),
221
'hook_contexts': [context.AMQPContext(ssl_dir=QUANTUM_CONF_DIR),
195
222
QuantumGatewayContext(),
196
223
SyslogContext()],
197
224
'services': ['quantum-l3-agent',
200
227
'quantum-plugin-openvswitch-agent']
202
229
QUANTUM_L3_AGENT_CONF: {
203
'hook_contexts': [NetworkServiceContext()],
230
'hook_contexts': [NetworkServiceContext(),
231
QuantumGatewayContext()],
204
232
'services': ['quantum-l3-agent']
206
# TODO: Check to see if this is actually required
207
234
QUANTUM_OVS_PLUGIN_CONF: {
208
'hook_contexts': [QuantumSharedDBContext(),
209
QuantumGatewayContext()],
235
'hook_contexts': [QuantumGatewayContext()],
210
236
'services': ['quantum-plugin-openvswitch-agent']
219
245
NEUTRON_OVS_CONFIG_FILES = {
221
'hook_contexts': [context.AMQPContext(),
247
'hook_contexts': [context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR),
222
248
QuantumGatewayContext(),
223
249
SyslogContext()],
224
250
'services': ['neutron-l3-agent',
225
251
'neutron-dhcp-agent',
226
252
'neutron-metadata-agent',
227
'neutron-plugin-openvswitch-agent']
253
'neutron-plugin-openvswitch-agent',
254
'neutron-plugin-metering-agent',
255
'neutron-metering-agent',
256
'neutron-lbaas-agent',
257
'neutron-plugin-vpn-agent',
229
260
NEUTRON_L3_AGENT_CONF: {
230
261
'hook_contexts': [NetworkServiceContext(),
232
'services': ['neutron-l3-agent']
234
# TODO: Check to see if this is actually required
263
QuantumGatewayContext()],
264
'services': ['neutron-l3-agent']
266
NEUTRON_METERING_AGENT_CONF: {
267
'hook_contexts': [QuantumGatewayContext()],
268
'services': ['neutron-plugin-metering-agent',
269
'neutron-metering-agent']
271
NEUTRON_LBAAS_AGENT_CONF: {
272
'hook_contexts': [QuantumGatewayContext()],
273
'services': ['neutron-lbaas-agent']
275
NEUTRON_VPNAAS_AGENT_CONF: {
276
'hook_contexts': [QuantumGatewayContext()],
277
'services': ['neutron-plugin-vpn-agent',
280
NEUTRON_FWAAS_CONF: {
281
'hook_contexts': [QuantumGatewayContext()],
282
'services': ['neutron-l3-agent']
235
284
NEUTRON_OVS_PLUGIN_CONF: {
236
'hook_contexts': [QuantumSharedDBContext(),
237
QuantumGatewayContext()],
285
'hook_contexts': [QuantumGatewayContext()],
286
'services': ['neutron-plugin-openvswitch-agent']
288
NEUTRON_ML2_PLUGIN_CONF: {
289
'hook_contexts': [QuantumGatewayContext()],
238
290
'services': ['neutron-plugin-openvswitch-agent']
247
299
QUANTUM_NVP_CONFIG_FILES = {
249
'hook_contexts': [context.AMQPContext()],
301
'hook_contexts': [context.AMQPContext(ssl_dir=QUANTUM_CONF_DIR)],
250
302
'services': ['quantum-dhcp-agent', 'quantum-metadata-agent']
255
307
NEUTRON_NVP_CONFIG_FILES = {
257
'hook_contexts': [context.AMQPContext()],
309
'hook_contexts': [context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR)],
258
310
'services': ['neutron-dhcp-agent', 'neutron-metadata-agent']
281
333
plugin = config('plugin')
282
334
name = networking_name()
336
# NOTE: deal with switch to ML2 plugin for >= icehouse
337
drop_config = NEUTRON_ML2_PLUGIN_CONF
338
if release >= 'icehouse':
339
drop_config = NEUTRON_OVS_PLUGIN_CONF
340
if drop_config in CONFIG_FILES[name][plugin]:
341
CONFIG_FILES[name][plugin].pop(drop_config)
283
343
for conf in CONFIG_FILES[name][plugin]:
284
344
configs.register(conf,
285
345
CONFIG_FILES[name][plugin][conf]['hook_contexts'])
305
365
that should be restarted when file changes.
368
plugin = config('plugin')
308
369
name = networking_name()
309
for f, ctxt in CONFIG_FILES[name][config('plugin')].iteritems():
370
for f, ctxt in CONFIG_FILES[name][plugin].iteritems():
311
372
for svc in ctxt['services']:
335
396
''' Try to import neutronclient instead for havana+ '''
336
397
from neutronclient.v2_0 import client
338
# TODO: Fixup for https keystone
339
auth_url = 'http://%(keystone_host)s:%(auth_port)s/v2.0' % env
399
auth_url = '%(auth_protocol)s://%(keystone_host)s:%(auth_port)s/v2.0' % env
340
400
quantum = client.Client(username=env['service_username'],
341
401
password=env['service_password'],
342
402
tenant_name=env['service_tenant'],
407
def do_openstack_upgrade(configs):
468
''' Returns a list of services associate with this charm '''
470
for v in restart_map().values():
471
_services = _services + v
472
return list(set(_services))
475
def do_openstack_upgrade():
409
477
Perform an upgrade. Takes care of upgrading packages, rewriting
410
478
configs, database migrations and potentially any other post-upgrade
413
:param configs: The charms main OSConfigRenderer object.
415
481
new_src = config('openstack-origin')
416
482
new_os_rel = get_os_codename_install_source(new_src)
418
483
log('Performing OpenStack upgrade to %s.' % (new_os_rel))
420
485
configure_installation_source(new_src)
423
488
'--option', 'Dpkg::Options::=--force-confdef',
425
490
apt_update(fatal=True)
426
apt_install(packages=get_early_packages(),
429
apt_install(packages=get_packages(),
491
apt_upgrade(options=dpkg_opts,
492
fatal=True, dist=True)
493
apt_install(get_early_packages(), fatal=True)
494
apt_install(get_packages(), fatal=True)
433
496
# set CONFIGS to load templates from new release
434
configs.set_release(openstack_release=new_os_rel)
497
configs = register_configs()
499
[service_restart(s) for s in services()]
437
503
def configure_ovs():