def neutron_plugin_api_changed():
    packages_to_purge = []
    if use_dvr():
        install_packages()
        # per 17.08 release notes L3HA + DVR is a Newton+ feature
        _os_release = os_release('neutron-common', base='icehouse')
        if (use_l3ha() and
                CompareOpenStackReleases(_os_release) >= 'newton'):
            install_l3ha_packages()

        # NOTE(hopem): don't uninstall keepalived if not using l3ha since that
        # results in neutron-l3-agent also being uninstalled (see LP 1819499).
    else:
        packages_to_purge = deepcopy(DVR_PACKAGES)
        packages_to_purge.extend(L3HA_PACKAGES)

    if packages_to_purge:
        purge_packages(packages_to_purge)

    # NOTE(fnordahl): It is important to write config to disk and perhaps
    # restart the openvswitch-swith service prior to attempting to do run-time
    # configuration of OVS as we may have to pass options to `ovs-ctl` for
    # `ovs-vswitchd` to run at all. LP: #1906280
    # TODO: make restart_on_change use contextlib.contextmanager
    @restart_on_change({cfg: service
                        for cfg, service in restart_map().items()
                        if cfg == OVS_DEFAULT})
    def _restart_before_runtime_config_when_required():
        CONFIGS.write_all()
    _restart_before_runtime_config_when_required()
    configure_ovs()
    # If dvr setting has changed, need to pass that on
    for rid in relation_ids('neutron-plugin'):
        neutron_plugin_joined(relation_id=rid)
示例#2
0
def neutron_plugin_api_changed():
    packages_to_purge = []
    if use_dvr():
        install_packages()
        # per 17.08 release notes L3HA + DVR is a Newton+ feature
        _os_release = os_release('neutron-common', base='icehouse')
        if (use_l3ha() and
                CompareOpenStackReleases(_os_release) >= 'newton'):
            install_l3ha_packages()

        # NOTE(hopem): don't uninstall keepalived if not using l3ha since that
        # results in neutron-l3-agent also being uninstalled (see LP 1819499).
    else:
        packages_to_purge = deepcopy(DVR_PACKAGES)
        packages_to_purge.extend(L3HA_PACKAGES)

    if packages_to_purge:
        purge_packages(packages_to_purge)

    configure_ovs()
    CONFIGS.write_all()
    # If dvr setting has changed, need to pass that on
    for rid in relation_ids('neutron-plugin'):
        neutron_plugin_joined(relation_id=rid)
def neutron_plugin_api_changed():
    packages_to_purge = []
    if use_dvr():
        install_packages()
        # per 17.08 release notes L3HA + DVR is a Newton+ feature
        _os_release = os_release('neutron-common', base='icehouse')
        if (use_l3ha() and
           CompareOpenStackReleases(_os_release) >= 'newton'):
            install_l3ha_packages()

        # NOTE(hopem): don't uninstall keepalived if not using l3ha since that
        # results in neutron-l3-agent also being uninstalled (see LP 1819499).
    else:
        packages_to_purge = deepcopy(DVR_PACKAGES)
        packages_to_purge.extend(L3HA_PACKAGES)

    if packages_to_purge:
        purge_packages(packages_to_purge)

    configure_ovs()
    CONFIGS.write_all()
    # If dvr setting has changed, need to pass that on
    for rid in relation_ids('neutron-plugin'):
        neutron_plugin_joined(relation_id=rid)
 def test_use_l3ha(self, _is_container, _NeutronAPIContext):
     _is_container.return_value = False
     _NeutronAPIContext()().get.return_value = True
     self.assertEquals(nutils.use_l3ha(), True)
     _is_container.return_value = True
     self.assertEquals(nutils.use_l3ha(), False)