def test_restart_map_ovs_odl(self):
        self.config.return_value = 'ovs-odl'
        self.get_os_codename_install_source.return_value = 'icehouse'
        ex_map = {
            neutron_utils.NEUTRON_CONF: ['neutron-l3-agent',
                                         'neutron-dhcp-agent',
                                         'neutron-metadata-agent',
                                         'neutron-plugin-metering-agent',
                                         'neutron-metering-agent',
                                         'neutron-lbaas-agent',
                                         'neutron-plugin-vpn-agent',
                                         'neutron-vpn-agent'],
            neutron_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'],
            neutron_utils.NEUTRON_LBAAS_AGENT_CONF:
            ['neutron-lbaas-agent'],
            neutron_utils.NEUTRON_METADATA_AGENT_CONF:
            ['neutron-metadata-agent'],
            neutron_utils.NEUTRON_VPNAAS_AGENT_CONF: [
                'neutron-plugin-vpn-agent',
                'neutron-vpn-agent'],
            neutron_utils.NEUTRON_L3_AGENT_CONF: ['neutron-l3-agent',
                                                  'neutron-vpn-agent'],
            neutron_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'],
            neutron_utils.NEUTRON_FWAAS_CONF: ['neutron-l3-agent',
                                               'neutron-vpn-agent'],
            neutron_utils.NEUTRON_METERING_AGENT_CONF:
            ['neutron-metering-agent', 'neutron-plugin-metering-agent'],
            neutron_utils.NOVA_CONF: ['nova-api-metadata'],
            neutron_utils.EXT_PORT_CONF: ['ext-port'],
            neutron_utils.PHY_NIC_MTU_CONF: ['os-charm-phy-nic-mtu'],
        }

        self.assertDictEqual(neutron_utils.restart_map(), ex_map)
Esempio n. 2
0
    def test_restart_map_ovs_odl_newton(self, mock_get_packages):
        self.config.return_value = 'ovs-odl'
        mock_get_packages.return_value = ['neutron-vpn-agent']
        self.os_release.return_value = 'newton'
        ex_map = {
            neutron_utils.NEUTRON_CONF: [
                'neutron-vpn-agent', 'neutron-lbaasv2-agent',
                'neutron-dhcp-agent', 'neutron-metering-agent',
                'neutron-metadata-agent'
            ],
            neutron_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'],
            neutron_utils.NEUTRON_LBAAS_AGENT_CONF: ['neutron-lbaasv2-agent'],
            neutron_utils.NEUTRON_METADATA_AGENT_CONF:
            ['neutron-metadata-agent'],
            neutron_utils.NEUTRON_VPNAAS_AGENT_CONF: ['neutron-vpn-agent'],
            neutron_utils.NEUTRON_L3_AGENT_CONF: ['neutron-vpn-agent'],
            neutron_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'],
            neutron_utils.NEUTRON_FWAAS_CONF: ['neutron-vpn-agent'],
            neutron_utils.NEUTRON_METERING_AGENT_CONF:
            ['neutron-metering-agent'],
            neutron_utils.NOVA_CONF: ['nova-api-metadata'],
            neutron_utils.EXT_PORT_CONF: ['ext-port'],
            neutron_utils.PHY_NIC_MTU_CONF: ['os-charm-phy-nic-mtu'],
            neutron_utils.NEUTRON_DHCP_AA_PROFILE_PATH: ['neutron-dhcp-agent'],
            neutron_utils.NEUTRON_LBAASV2_AA_PROFILE_PATH:
            ['neutron-lbaasv2-agent'],
            neutron_utils.NEUTRON_METADATA_AA_PROFILE_PATH:
            ['neutron-metadata-agent'],
            neutron_utils.NEUTRON_METERING_AA_PROFILE_PATH:
            ['neutron-metering-agent'],
            neutron_utils.NOVA_API_METADATA_AA_PROFILE_PATH:
            ['nova-api-metadata'],
        }

        self.assertEqual(neutron_utils.restart_map(), ex_map)
Esempio n. 3
0
 def test_restart_map_ovs_post_trusty(self, mock_get_packages):
     self.config.return_value = 'ovs'
     # No VPN agent after trusty
     mock_get_packages.return_value = ['neutron-l3-agent']
     self.os_release.return_value = 'diablo'
     rmap = neutron_utils.restart_map()
     for services in rmap.values():
         self.assertFalse('neutron-vpn-agent' in services)
 def test_restart_map_ovs_post_trusty(self, mock_get_packages):
     self.patch_object(neutron_utils, 'disable_nova_metadata',
                       return_value=False)
     self.config.return_value = 'ovs'
     # No VPN agent after trusty
     mock_get_packages.return_value = ['neutron-l3-agent']
     self.os_release.return_value = 'diablo'
     rmap = neutron_utils.restart_map()
     for services in rmap.values():
         self.assertFalse('neutron-vpn-agent' in services)
 def test_restart_map_nvp(self):
     self.config.return_value = 'nvp'
     ex_map = {
         neutron_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'],
         neutron_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'],
         neutron_utils.NOVA_CONF: ['nova-api-metadata'],
         neutron_utils.NEUTRON_CONF: ['neutron-dhcp-agent',
                                      'neutron-metadata-agent'],
         neutron_utils.NEUTRON_METADATA_AGENT_CONF:
         ['neutron-metadata-agent'],
     }
     self.assertEquals(neutron_utils.restart_map(), ex_map)
Esempio n. 6
0
 def test_restart_map_ovs(self, mock_get_packages):
     self.patch_object(neutron_utils, 'disable_nova_metadata',
                       return_value=False)
     self.config.return_value = 'ovs'
     self.get_os_codename_install_source.return_value = 'havana'
     mock_get_packages.return_value = ['neutron-vpn-agent']
     self.os_release.return_value = 'icehouse'
     ex_map = {
         neutron_utils.NEUTRON_CONF: ['neutron-lbaas-agent',
                                      'neutron-plugin-openvswitch-agent',
                                      'neutron-vpn-agent',
                                      'neutron-dhcp-agent',
                                      'neutron-metering-agent',
                                      'neutron-metadata-agent'],
         neutron_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'],
         neutron_utils.NEUTRON_LBAAS_AGENT_CONF:
         ['neutron-lbaas-agent'],
         neutron_utils.NEUTRON_ML2_PLUGIN_CONF:
         ['neutron-plugin-openvswitch-agent'],
         neutron_utils.NEUTRON_METADATA_AGENT_CONF:
         ['neutron-metadata-agent'],
         neutron_utils.NEUTRON_VPNAAS_AGENT_CONF: [
             'neutron-vpn-agent'],
         neutron_utils.NEUTRON_L3_AGENT_CONF: ['neutron-vpn-agent'],
         neutron_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'],
         neutron_utils.NEUTRON_FWAAS_CONF: ['neutron-vpn-agent'],
         neutron_utils.NEUTRON_METERING_AGENT_CONF:
         ['neutron-metering-agent'],
         neutron_utils.NOVA_CONF: ['nova-api-metadata'],
         neutron_utils.EXT_PORT_CONF: ['ext-port'],
         neutron_utils.PHY_NIC_MTU_CONF: ['os-charm-phy-nic-mtu'],
         neutron_utils.NEUTRON_DHCP_AA_PROFILE_PATH: ['neutron-dhcp-agent'],
         neutron_utils.NEUTRON_OVS_AA_PROFILE_PATH:
             ['neutron-plugin-openvswitch-agent'],
         neutron_utils.NEUTRON_L3_AA_PROFILE_PATH: ['neutron-vpn-agent'],
         neutron_utils.NEUTRON_LBAAS_AA_PROFILE_PATH:
         ['neutron-lbaas-agent'],
         neutron_utils.NEUTRON_METADATA_AA_PROFILE_PATH:
         ['neutron-metadata-agent'],
         neutron_utils.NEUTRON_METERING_AA_PROFILE_PATH:
         ['neutron-metering-agent'],
         neutron_utils.NOVA_API_METADATA_AA_PROFILE_PATH:
         ['nova-api-metadata'],
     }
     self.assertEqual(neutron_utils.restart_map(), ex_map)
 def test_restart_map_ovs(self, mock_get_packages):
     self.patch_object(neutron_utils, 'disable_nova_metadata',
                       return_value=False)
     self.config.return_value = 'ovs'
     self.get_os_codename_install_source.return_value = 'havana'
     mock_get_packages.return_value = ['neutron-vpn-agent']
     self.os_release.return_value = 'icehouse'
     ex_map = {
         neutron_utils.NEUTRON_CONF: ['neutron-lbaas-agent',
                                      'neutron-plugin-openvswitch-agent',
                                      'neutron-vpn-agent',
                                      'neutron-dhcp-agent',
                                      'neutron-metering-agent',
                                      'neutron-metadata-agent'],
         neutron_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'],
         neutron_utils.NEUTRON_LBAAS_AGENT_CONF:
         ['neutron-lbaas-agent'],
         neutron_utils.NEUTRON_ML2_PLUGIN_CONF:
         ['neutron-plugin-openvswitch-agent'],
         neutron_utils.NEUTRON_METADATA_AGENT_CONF:
         ['neutron-metadata-agent'],
         neutron_utils.NEUTRON_VPNAAS_AGENT_CONF: [
             'neutron-vpn-agent'],
         neutron_utils.NEUTRON_L3_AGENT_CONF: ['neutron-vpn-agent'],
         neutron_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'],
         neutron_utils.NEUTRON_FWAAS_CONF: ['neutron-vpn-agent'],
         neutron_utils.NEUTRON_METERING_AGENT_CONF:
         ['neutron-metering-agent'],
         neutron_utils.NOVA_CONF: ['nova-api-metadata'],
         neutron_utils.EXT_PORT_CONF: ['ext-port'],
         neutron_utils.PHY_NIC_MTU_CONF: ['os-charm-phy-nic-mtu'],
         neutron_utils.NEUTRON_DHCP_AA_PROFILE_PATH: ['neutron-dhcp-agent'],
         neutron_utils.NEUTRON_OVS_AA_PROFILE_PATH:
             ['neutron-plugin-openvswitch-agent'],
         neutron_utils.NEUTRON_L3_AA_PROFILE_PATH: ['neutron-vpn-agent'],
         neutron_utils.NEUTRON_LBAAS_AA_PROFILE_PATH:
         ['neutron-lbaas-agent'],
         neutron_utils.NEUTRON_METADATA_AA_PROFILE_PATH:
         ['neutron-metadata-agent'],
         neutron_utils.NEUTRON_METERING_AA_PROFILE_PATH:
         ['neutron-metering-agent'],
         neutron_utils.NOVA_API_METADATA_AA_PROFILE_PATH:
         ['nova-api-metadata'],
     }
     self.assertEqual(neutron_utils.restart_map(), ex_map)
    def test_restart_map_ovs_odl_newton(self, mock_get_packages):
        self.patch_object(neutron_utils, 'disable_nova_metadata',
                          return_value=False)
        self.config.return_value = 'ovs-odl'
        mock_get_packages.return_value = ['neutron-vpn-agent']
        self.os_release.return_value = 'newton'
        ex_map = {
            neutron_utils.NEUTRON_CONF: ['neutron-vpn-agent',
                                         'neutron-lbaasv2-agent',
                                         'neutron-dhcp-agent',
                                         'neutron-metering-agent',
                                         'neutron-metadata-agent'],
            neutron_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'],
            neutron_utils.NEUTRON_LBAAS_AGENT_CONF:
            ['neutron-lbaasv2-agent'],
            neutron_utils.NEUTRON_METADATA_AGENT_CONF:
            ['neutron-metadata-agent'],
            neutron_utils.NEUTRON_VPNAAS_AGENT_CONF: ['neutron-vpn-agent'],
            neutron_utils.NEUTRON_L3_AGENT_CONF: ['neutron-vpn-agent'],
            neutron_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'],
            neutron_utils.NEUTRON_FWAAS_CONF: ['neutron-vpn-agent'],
            neutron_utils.NEUTRON_METERING_AGENT_CONF:
            ['neutron-metering-agent'],
            neutron_utils.NOVA_CONF: ['nova-api-metadata'],
            neutron_utils.EXT_PORT_CONF: ['ext-port'],
            neutron_utils.PHY_NIC_MTU_CONF: ['os-charm-phy-nic-mtu'],
            neutron_utils.NEUTRON_DHCP_AA_PROFILE_PATH: ['neutron-dhcp-agent'],
            neutron_utils.NEUTRON_LBAASV2_AA_PROFILE_PATH:
            ['neutron-lbaasv2-agent'],
            neutron_utils.NEUTRON_METADATA_AA_PROFILE_PATH:
            ['neutron-metadata-agent'],
            neutron_utils.NEUTRON_METERING_AA_PROFILE_PATH:
            ['neutron-metering-agent'],
            neutron_utils.NOVA_API_METADATA_AA_PROFILE_PATH:
            ['nova-api-metadata'],
        }

        self.assertEqual(neutron_utils.restart_map(), ex_map)
Esempio n. 9
0
                    fatal=True)
        apt_install(filter_installed_packages(get_packages()), fatal=True)
        status_set('maintenance', 'Git install')
        git_install(config('openstack-origin-git'))
    else:
        message = 'Please provide a valid plugin config'
        log(message, level=ERROR)
        status_set('blocked', message)
        sys.exit(1)

    # Legacy HA for Icehouse
    update_legacy_ha_files()


@hooks.hook('config-changed')
@restart_on_change(restart_map())
def config_changed():
    global CONFIGS
    if git_install_requested():
        if config_value_changed('openstack-origin-git'):
            status_set('maintenance', 'Running Git install')
            git_install(config('openstack-origin-git'))
            CONFIGS.write_all()

    elif not config('action-managed-upgrade'):
        if openstack_upgrade_available(NEUTRON_COMMON):
            status_set('maintenance', 'Running openstack upgrade')
            do_openstack_upgrade(CONFIGS)

    update_nrpe_config()
    else:
        message = 'Please provide a valid plugin config'
        log(message, level=ERROR)
        status_set('blocked', message)
        sys.exit(1)

    # Legacy HA for Icehouse
    update_legacy_ha_files()

    # Install systemd overrides to remove service startup race between
    # n-gateway and n-cloud-controller services.
    install_systemd_override()


@hooks.hook('config-changed')
@restart_on_change(restart_map())
@harden()
def config_changed():
    global CONFIGS
    if not config('action-managed-upgrade'):
        if openstack_upgrade_available(NEUTRON_COMMON):
            status_set('maintenance', 'Running openstack upgrade')
            do_openstack_upgrade(CONFIGS)

    update_nrpe_config()

    sysctl_settings = config('sysctl')
    if sysctl_settings:
        create_sysctl(sysctl_settings,
                      '/etc/sysctl.d/50-quantum-gateway.conf')
Esempio n. 11
0
    else:
        message = 'Please provide a valid plugin config'
        log(message, level=ERROR)
        status_set('blocked', message)
        sys.exit(1)

    # Legacy HA for Icehouse
    update_legacy_ha_files()

    # Install systemd overrides to remove service startup race between
    # n-gateway and n-cloud-controller services.
    install_systemd_override()


@hooks.hook('config-changed')
@restart_on_change(restart_map())
@harden()
def config_changed():
    global CONFIGS
    if git_install_requested():
        if config_value_changed('openstack-origin-git'):
            status_set('maintenance', 'Running Git install')
            git_install(config('openstack-origin-git'))
            CONFIGS.write_all()

    elif not config('action-managed-upgrade'):
        if openstack_upgrade_available(NEUTRON_COMMON):
            status_set('maintenance', 'Running openstack upgrade')
            do_openstack_upgrade(CONFIGS)

    update_nrpe_config()
Esempio n. 12
0
    else:
        message = 'Please provide a valid plugin config'
        log(message, level=ERROR)
        status_set('blocked', message)
        sys.exit(1)

    # Legacy HA for Icehouse
    update_legacy_ha_files()

    # Install systemd overrides to remove service startup race between
    # n-gateway and n-cloud-controller services.
    install_systemd_override()


@hooks.hook('config-changed')
@restart_on_change(restart_map())
@harden()
def config_changed():
    global CONFIGS
    if not config('action-managed-upgrade'):
        if openstack_upgrade_available(NEUTRON_COMMON):
            status_set('maintenance', 'Running openstack upgrade')
            do_openstack_upgrade(CONFIGS)

    update_nrpe_config()

    sysctl_settings = config('sysctl')
    if sysctl_settings:
        if is_container():
            log("Cannot create sysctls inside of a container", level=WARNING)
        else: