~ionutbalutoiu/charms/trusty/neutron-api/next

« back to all changes in this revision

Viewing changes to hooks/neutron_api_hooks.py

  • Committer: James Page
  • Date: 2015-09-04 11:03:14 UTC
  • mfrom: (39.7.35 trunk)
  • Revision ID: james.page@ubuntu.com-20150904110314-1iym0vseisumy5d0
[project-calico,r=james-page] Add support for Calico plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
    services,
61
61
    setup_ipv6,
62
62
    get_topics,
 
63
    additional_install_locations,
 
64
    force_etcd_restart,
63
65
)
64
66
from neutron_api_context import (
65
67
    get_dvr,
67
69
    get_l2population,
68
70
    get_overlay_network_type,
69
71
    IdentityServiceContext,
 
72
    EtcdContext,
70
73
)
71
74
 
72
75
from charmhelpers.contrib.hahelpers.cluster import (
143
146
def install():
144
147
    execd_preinstall()
145
148
    configure_installation_source(config('openstack-origin'))
 
149
    additional_install_locations(
 
150
        config('neutron-plugin'), config('openstack-origin')
 
151
    )
146
152
 
147
153
    apt_update()
148
154
    apt_install(determine_packages(config('openstack-origin')),
183
189
        if openstack_upgrade_available('neutron-common'):
184
190
            do_openstack_upgrade(CONFIGS)
185
191
 
 
192
    additional_install_locations(
 
193
        config('neutron-plugin'),
 
194
        config('openstack-origin')
 
195
    )
186
196
    apt_install(filter_installed_packages(
187
197
                determine_packages(config('openstack-origin'))),
188
198
                fatal=True)
352
362
            'enable-dvr': get_dvr(),
353
363
            'enable-l3ha': get_l3ha(),
354
364
            'overlay-network-type': get_overlay_network_type(),
 
365
            'addr': unit_get('private-address'),
355
366
        }
356
367
 
357
368
        # Provide this value to relations since it needs to be set in multiple
500
511
    nrpe_setup.write()
501
512
 
502
513
 
 
514
@hooks.hook('etcd-proxy-relation-joined')
 
515
@hooks.hook('etcd-proxy-relation-changed')
 
516
def etcd_proxy_force_restart(relation_id=None):
 
517
    # note(cory.benfield): Mostly etcd does not require active management,
 
518
    # but occasionally it does require a full config nuking. This does not
 
519
    # play well with the standard neutron-api config management, so we
 
520
    # treat etcd like the special snowflake it insists on being.
 
521
    CONFIGS.register('/etc/init/etcd.conf', [EtcdContext()])
 
522
    CONFIGS.write('/etc/init/etcd.conf')
 
523
 
 
524
    if 'etcd-proxy' in CONFIGS.complete_contexts():
 
525
        force_etcd_restart()
 
526
 
 
527
 
503
528
def main():
504
529
    try:
505
530
        hooks.execute(sys.argv)