コード例 #1
0
 def test_register_configs_nsx(self, mock_renderer):
     self.config.return_value = 'nsx'
     configs = neutron_utils.register_configs()
     confs = [neutron_utils.NEUTRON_DHCP_AGENT_CONF,
              neutron_utils.NEUTRON_METADATA_AGENT_CONF,
              neutron_utils.NOVA_CONF,
              neutron_utils.NEUTRON_CONF]
     for conf in confs:
         configs.register.assert_any_call(conf, ANY)
コード例 #2
0
 def test_register_configs_pre_install(self, mock_renderer):
     self.config.return_value = 'ovs'
     self.is_relation_made.return_value = False
     configs = neutron_utils.register_configs()
     confs = [neutron_utils.NOVA_CONF,
              neutron_utils.NEUTRON_CONF,
              neutron_utils.NEUTRON_L3_AGENT_CONF,
              neutron_utils.NEUTRON_ML2_PLUGIN_CONF,
              neutron_utils.EXT_PORT_CONF]
     for conf in confs:
         configs.register.assert_any_call(conf, ANY)
コード例 #3
0
 def test_register_configs_nsx(self, mock_renderer):
     self.config.return_value = 'nsx'
     self.os_release.return_value = 'diablo'
     configs = neutron_utils.register_configs()
     confs = [
         neutron_utils.NEUTRON_DHCP_AGENT_CONF,
         neutron_utils.NEUTRON_METADATA_AGENT_CONF, neutron_utils.NOVA_CONF,
         neutron_utils.NEUTRON_CONF
     ]
     for conf in confs:
         configs.register.assert_any_call(conf, ANY)
コード例 #4
0
 def test_register_configs_nsx(self, mock_renderer):
     self.patch_object(neutron_utils, 'disable_nova_metadata',
                       return_value=False)
     self.config.return_value = 'nsx'
     self.os_release.return_value = 'diablo'
     configs = neutron_utils.register_configs()
     confs = [neutron_utils.NEUTRON_DHCP_AGENT_CONF,
              neutron_utils.NEUTRON_METADATA_AGENT_CONF,
              neutron_utils.NOVA_CONF,
              neutron_utils.NEUTRON_CONF]
     for conf in confs:
         configs.register.assert_any_call(conf, ANY)
コード例 #5
0
 def test_register_configs_pre_install(self, mock_renderer):
     self.config.return_value = 'ovs'
     self.is_relation_made.return_value = False
     self.os_release.return_value = 'diablo'
     configs = neutron_utils.register_configs()
     confs = [
         neutron_utils.NOVA_CONF, neutron_utils.NEUTRON_CONF,
         neutron_utils.NEUTRON_L3_AGENT_CONF,
         neutron_utils.NEUTRON_ML2_PLUGIN_CONF, neutron_utils.EXT_PORT_CONF
     ]
     for conf in confs:
         configs.register.assert_any_call(conf, ANY)
コード例 #6
0
def resolve_CONFIGS():
    """lazy function to resolve the CONFIGS so that it doesn't have to evaluate
    at module load time.  Note that it also returns the CONFIGS so that it can
    be used in other, module loadtime, functions.

    :returns: CONFIGS variable
    :rtype: `:class:templating.OSConfigRenderer`
    """
    global CONFIGS
    if CONFIGS is None:
        CONFIGS = register_configs()
    return CONFIGS
コード例 #7
0
 def test_register_configs_nsx(self):
     self.config.return_value = 'nsx'
     configs = neutron_utils.register_configs()
     confs = [neutron_utils.NEUTRON_DHCP_AGENT_CONF,
              neutron_utils.NEUTRON_METADATA_AGENT_CONF,
              neutron_utils.NOVA_CONF,
              neutron_utils.NEUTRON_CONF]
     for conf in confs:
         configs.register.assert_any_call(
             conf,
             neutron_utils.CONFIG_FILES['neutron'][neutron_utils.NSX][conf]
                                       ['hook_contexts']
         )
コード例 #8
0
 def test_register_configs_ovs_odl(self, mock_renderer):
     self.config.side_effect = self.test_config.get
     self.test_config.set('plugin', 'ovs-odl')
     self.is_relation_made.return_value = False
     self.get_os_codename_install_source.return_value = 'icehouse'
     configs = neutron_utils.register_configs()
     confs = [neutron_utils.NEUTRON_DHCP_AGENT_CONF,
              neutron_utils.NEUTRON_METADATA_AGENT_CONF,
              neutron_utils.NOVA_CONF,
              neutron_utils.NEUTRON_CONF,
              neutron_utils.NEUTRON_L3_AGENT_CONF,
              neutron_utils.EXT_PORT_CONF]
     for conf in confs:
         configs.register.assert_any_call(conf, ANY)
コード例 #9
0
 def test_register_configs_pre_install(self, mock_renderer):
     self.patch_object(neutron_utils, 'disable_nova_metadata',
                       return_value=False)
     self.config.return_value = 'ovs'
     self.is_relation_made.return_value = False
     self.os_release.return_value = 'diablo'
     configs = neutron_utils.register_configs()
     confs = [neutron_utils.NOVA_CONF,
              neutron_utils.NEUTRON_CONF,
              neutron_utils.NEUTRON_L3_AGENT_CONF,
              neutron_utils.NEUTRON_ML2_PLUGIN_CONF,
              neutron_utils.EXT_PORT_CONF]
     for conf in confs:
         configs.register.assert_any_call(conf, ANY)
コード例 #10
0
 def test_register_configs_ovs_odl(self, mock_renderer):
     self.config.side_effect = self.test_config.get
     self.test_config.set('plugin', 'ovs-odl')
     self.is_relation_made.return_value = False
     self.get_os_codename_install_source.return_value = 'icehouse'
     self.os_release.return_value = 'icehouse'
     configs = neutron_utils.register_configs()
     confs = [
         neutron_utils.NEUTRON_DHCP_AGENT_CONF,
         neutron_utils.NEUTRON_METADATA_AGENT_CONF, neutron_utils.NOVA_CONF,
         neutron_utils.NEUTRON_CONF, neutron_utils.NEUTRON_L3_AGENT_CONF,
         neutron_utils.EXT_PORT_CONF
     ]
     for conf in confs:
         configs.register.assert_any_call(conf, ANY)
コード例 #11
0
 def test_register_configs_amqp_nova(self, mock_renderer):
     self.patch_object(neutron_utils, 'disable_nova_metadata',
                       return_value=False)
     self.config.return_value = 'ovs'
     self.is_relation_made.return_value = True
     self.os_release.return_value = 'diablo'
     configs = neutron_utils.register_configs()
     confs = [neutron_utils.NEUTRON_DHCP_AGENT_CONF,
              neutron_utils.NEUTRON_METADATA_AGENT_CONF,
              neutron_utils.NOVA_CONF,
              neutron_utils.NEUTRON_CONF,
              neutron_utils.NEUTRON_L3_AGENT_CONF,
              neutron_utils.NEUTRON_ML2_PLUGIN_CONF,
              neutron_utils.EXT_PORT_CONF]
     for conf in confs:
         configs.register.assert_any_call(conf, ANY)
コード例 #12
0
 def test_register_configs_amqp_nova(self):
     self.config.return_value = 'ovs'
     self.is_relation_made.return_value = True
     configs = neutron_utils.register_configs()
     confs = [neutron_utils.NEUTRON_DHCP_AGENT_CONF,
              neutron_utils.NEUTRON_METADATA_AGENT_CONF,
              neutron_utils.NOVA_CONF,
              neutron_utils.NEUTRON_CONF,
              neutron_utils.NEUTRON_L3_AGENT_CONF,
              neutron_utils.NEUTRON_OVS_PLUGIN_CONF,
              neutron_utils.EXT_PORT_CONF]
     for conf in confs:
         configs.register.assert_any_call(
             conf,
             neutron_utils.CONFIG_FILES['neutron'][neutron_utils.OVS][conf]
                                       ['hook_contexts']
         )
コード例 #13
0
 def test_register_configs_ovs_odl(self):
     self.config.side_effect = self.test_config.get
     self.test_config.set('plugin', 'ovs-odl')
     self.is_relation_made.return_value = False
     self.get_os_codename_install_source.return_value = 'icehouse'
     configs = neutron_utils.register_configs()
     confs = [neutron_utils.NEUTRON_DHCP_AGENT_CONF,
              neutron_utils.NEUTRON_METADATA_AGENT_CONF,
              neutron_utils.NOVA_CONF,
              neutron_utils.NEUTRON_CONF,
              neutron_utils.NEUTRON_L3_AGENT_CONF,
              neutron_utils.EXT_PORT_CONF]
     for conf in confs:
         configs.register.assert_any_call(
             conf,
             neutron_utils.CONFIG_FILES['neutron']
                                       [neutron_utils.OVS_ODL][conf]
                                       ['hook_contexts']
         )
コード例 #14
0
 def test_register_configs_pre_install(self):
     self.config.return_value = 'ovs'
     self.is_relation_made.return_value = False
     self.networking_name.return_value = 'quantum'
     configs = neutron_utils.register_configs()
     confs = [neutron_utils.QUANTUM_DHCP_AGENT_CONF,
              neutron_utils.QUANTUM_METADATA_AGENT_CONF,
              neutron_utils.NOVA_CONF,
              neutron_utils.QUANTUM_CONF,
              neutron_utils.QUANTUM_L3_AGENT_CONF,
              neutron_utils.QUANTUM_OVS_PLUGIN_CONF,
              neutron_utils.EXT_PORT_CONF]
     print configs.register.mock_calls
     for conf in confs:
         configs.register.assert_any_call(
             conf,
             neutron_utils.CONFIG_FILES['quantum'][neutron_utils.OVS][conf]
                                       ['hook_contexts']
         )
コード例 #15
0
 def test_do_openstack_upgrade(self, git_requested):
     git_requested.return_value = False
     self.config.side_effect = self.test_config.get
     self.is_relation_made.return_value = False
     self.test_config.set('openstack-origin', 'cloud:precise-havana')
     self.test_config.set('plugin', 'ovs')
     self.get_os_codename_install_source.return_value = 'havana'
     configs = neutron_utils.register_configs()
     neutron_utils.do_openstack_upgrade(configs)
     self.assertTrue(self.log.called)
     self.apt_update.assert_called_with(fatal=True)
     dpkg_opts = [
         '--option', 'Dpkg::Options::=--force-confnew',
         '--option', 'Dpkg::Options::=--force-confdef',
     ]
     self.apt_upgrade.assert_called_with(
         options=dpkg_opts, fatal=True, dist=True
     )
     self.configure_installation_source.assert_called_with(
         'cloud:precise-havana'
     )
コード例 #16
0
def restart(args):
    """Restart services.

    :param args: Unused
    :type args: List[str]
    """
    deferred_only = action_get("deferred-only")
    services = action_get("services").split()
    # Check input
    if deferred_only and services:
        action_fail("Cannot set deferred-only and services")
        return
    if not (deferred_only or services):
        action_fail("Please specify deferred-only or services")
        return
    if action_get('run-hooks'):
        log("Charm does not defer any hooks at present", DEBUG)
    if deferred_only:
        os_utils.restart_services_action(deferred_only=True)
    else:
        os_utils.restart_services_action(services=services)
    assess_status(register_configs())
コード例 #17
0
    cache_env_data,
    update_legacy_ha_files,
    remove_legacy_ha_files,
    install_legacy_ha_files,
    cleanup_ovs_netns,
    reassign_agent_resources,
    stop_neutron_ha_monitor_daemon,
    use_l3ha,
    REQUIRED_INTERFACES,
    check_optional_relations,
    NEUTRON_COMMON,
    remove_file,
)

hooks = Hooks()
CONFIGS = register_configs()


@hooks.hook('install.real')
def install():
    status_set('maintenance', 'Executing pre-install')
    execd_preinstall()
    src = config('openstack-origin')
    if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and src == 'distro'):
        src = 'cloud:precise-icehouse'
    configure_installation_source(src)
    status_set('maintenance', 'Installing apt packages')
    apt_update(fatal=True)
    apt_install('python-six', fatal=True)  # Force upgrade
    if valid_plugin():
        apt_install(filter_installed_packages(get_early_packages()),
コード例 #18
0
    stop_neutron_ha_monitor_daemon,
    use_l3ha,
    NEUTRON_COMMON,
    assess_status,
    install_systemd_override,
    configure_apparmor,
    write_vendordata,
    pause_unit_helper,
    resume_unit_helper,
    remove_legacy_nova_metadata,
    disable_nova_metadata,
    remove_old_packages,
)

hooks = Hooks()
CONFIGS = register_configs()


@hooks.hook('install')
@harden()
def install():
    status_set('maintenance', 'Executing pre-install')
    execd_preinstall()
    src = config('openstack-origin')
    if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and
            src == 'distro'):
        src = 'cloud:precise-icehouse'
    configure_installation_source(src)
    status_set('maintenance', 'Installing apt packages')
    apt_update(fatal=True)
    apt_install('python-six', fatal=True)  # Force upgrade
コード例 #19
0
def pause(args):
    """Pause the Ceilometer services.
    @raises Exception should the service fail to stop.
    """
    pause_unit_helper(register_configs())
コード例 #20
0
def resume(args):
    """Resume the Ceilometer services.
    @raises Exception should the service fail to start."""
    resume_unit_helper(register_configs())
コード例 #21
0
def resume(args):
    """Resume the Ceilometer services.
    @raises Exception should the service fail to start."""
    resume_unit_helper(register_configs())
コード例 #22
0
def pause(args):
    """Pause the Ceilometer services.
    @raises Exception should the service fail to stop.
    """
    pause_unit_helper(register_configs())