Exemplo n.º 1
0
    def __init__(self, options=None, config_file=None):
        # If no options have been provided, create an empty dict
        if not options:
            options = {}

        msg = validate_pre_plugin_load()
        if msg:
            LOG.critical(msg)
            raise Exception(msg)

        # NOTE(jkoelker) Testing for the subclass with the __subclasshook__
        #                breaks tach monitoring. It has been removed
        #                intentionally to allow v2 plugins to be monitored
        #                for performance metrics.
        plugin_provider = cfg.CONF.core_plugin
        LOG.info(_("Loading core plugin: %s"), plugin_provider)
        self.plugin = self._get_plugin_instance('neutron.core_plugins',
                                                plugin_provider)
        legacy.modernize_quantum_config(cfg.CONF)

        msg = validate_post_plugin_load()
        if msg:
            LOG.critical(msg)
            raise Exception(msg)

        # core plugin as a part of plugin collection simplifies
        # checking extensions
        # TODO(enikanorov): make core plugin the same as
        # the rest of service plugins
        self.service_plugins = {constants.CORE: self.plugin}
        self._load_service_plugins()
Exemplo n.º 2
0
    def __init__(self, options=None, config_file=None):
        # If no options have been provided, create an empty dict
        if not options:
            options = {}

        msg = validate_pre_plugin_load()
        if msg:
            LOG.critical(msg)
            raise Exception(msg)

        # NOTE(jkoelker) Testing for the subclass with the __subclasshook__
        #                breaks tach monitoring. It has been removed
        #                intentionally to allow v2 plugins to be monitored
        #                for performance metrics.
        plugin_provider = cfg.CONF.core_plugin
        LOG.info(_("Loading core plugin: %s"), plugin_provider)
        self.plugin = self._get_plugin_instance('neutron.core_plugins',
                                                plugin_provider)
        legacy.modernize_quantum_config(cfg.CONF)

        msg = validate_post_plugin_load()
        if msg:
            LOG.critical(msg)
            raise Exception(msg)

        # core plugin as a part of plugin collection simplifies
        # checking extensions
        # TODO(enikanorov): make core plugin the same as
        # the rest of service plugins
        self.service_plugins = {constants.CORE: self.plugin}
        self._load_service_plugins()
Exemplo n.º 3
0
def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(ip_lib.OPTS)
    cfg.CONF(project='neutron')
    logging_config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)

    try:
        agent_config = create_agent_config_map(cfg.CONF)
    except ValueError as e:
        LOG.error(_('%s Agent terminated!'), e)
        sys.exit(1)

    is_xen_compute_host = 'rootwrap-xen-dom0' in agent_config['root_helper']
    if is_xen_compute_host:
        # Force ip_lib to always use the root helper to ensure that ip
        # commands target xen dom0 rather than domU.
        cfg.CONF.set_default('ip_lib_force_root', True)

    plugin = OVSNeutronAgent(**agent_config)

    # Start everything.
    LOG.info(_("Agent initialized successfully, now running... "))
    plugin.daemon_loop()
    sys.exit(0)
Exemplo n.º 4
0
def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(ip_lib.OPTS)
    cfg.CONF(project='neutron')
    logging_config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)

    try:
        agent_config = create_agent_config_map(cfg.CONF)
    except ValueError as e:
        LOG.error(_('%s Agent terminated!'), e)
        sys.exit(1)

    is_xen_compute_host = 'rootwrap-xen-dom0' in agent_config['root_helper']
    if is_xen_compute_host:
        # Force ip_lib to always use the root helper to ensure that ip
        # commands target xen dom0 rather than domU.
        cfg.CONF.set_default('ip_lib_force_root', True)

    plugin = OVSNeutronAgent(**agent_config)

    # Start everything.
    LOG.info(_("Agent initialized successfully, now running... "))
    plugin.daemon_loop()
    sys.exit(0)
Exemplo n.º 5
0
def parse(args):
    cfg.CONF(args=args, project='neutron',
             version='%%prog %s' % neutron_version.release_string())

    legacy.modernize_quantum_config(cfg.CONF)

    # Validate that the base_mac is of the correct format
    msg = attributes._validate_regex(cfg.CONF.base_mac,
                                     attributes.MAC_PATTERN)
    if msg:
        msg = _("Base MAC: %s") % msg
        raise Exception(msg)
Exemplo n.º 6
0
def main():
    eventlet.monkey_patch()
    register_options()
    cfg.CONF(project='neutron')
    config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)
    server = neutron_service.Service.create(
        binary='neutron-dhcp-agent',
        topic=topics.DHCP_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron.agent.dhcp_agent.DhcpAgentWithStateReport')
    service.launch(server).wait()
Exemplo n.º 7
0
def main():
    config = alembic_config.Config(
        os.path.join(os.path.dirname(__file__), 'alembic.ini')
    )
    config.set_main_option('script_location',
                           'neutron.db.migration:alembic_migrations')
    # attach the Neutron conf to the Alembic conf
    config.neutron_config = CONF

    CONF()
    legacy.modernize_quantum_config(CONF)
    CONF.command.func(config, CONF.command.name)
Exemplo n.º 8
0
def main(manager="neutron.services.skycloud.portforward_agent.PortForwardAgent"):
    eventlet.monkey_patch()
    conf = cfg.CONF
    conf(project='neutron')
    config.setup_logging(conf)
    legacy.modernize_quantum_config(conf)
    server = neutron_service.Service.create(
        binary='neutron-portforward-agent',
        topic=skycloud_constants.PORT_FORWARD_AGENT_TOPIC,
        report_interval=60, host=conf.host,
        manager=manager)
    service.launch(server).wait()
Exemplo n.º 9
0
def main():
    eventlet.monkey_patch()
    register_options()
    cfg.CONF(project='neutron')
    config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)
    server = neutron_service.Service.create(
        binary='neutron-dhcp-agent',
        topic=topics.DHCP_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron.agent.dhcp_agent.DhcpAgentWithStateReport')
    service.launch(server).wait()
Exemplo n.º 10
0
def main():
    config = alembic_config.Config(
        os.path.join(os.path.dirname(__file__), 'alembic.ini'))
    config.set_main_option('script_location',
                           'neutron.db.migration:alembic_migrations')
    # attach the Neutron conf to the Alembic conf
    config.neutron_config = CONF

    CONF()
    #TODO(gongysh) enable logging
    legacy.modernize_quantum_config(CONF)
    CONF.command.func(config, CONF.command.name)
Exemplo n.º 11
0
def main():
    config.init(sys.argv[1:])
    if not cfg.CONF.config_file:
        sys.exit(_("ERROR: Unable to find configuration file via the default"
                   " search paths (~/.neutron/, ~/, /etc/neutron/, /etc/) and"
                   " the '--config-file' option!"))

    config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)
    utils.log_opt_values(LOG)

    neutron_api = Neutron(prog='neutron')
    neutron_api.run()
Exemplo n.º 12
0
def main():
    config.init(sys.argv[1:])
    if not cfg.CONF.config_file:
        sys.exit(
            _("ERROR: Unable to find configuration file via the default"
              " search paths (~/.neutron/, ~/, /etc/neutron/, /etc/) and"
              " the '--config-file' option!"))

    config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)
    utils.log_opt_values(LOG)

    neutron_api = Neutron(prog='neutron')
    neutron_api.run()
Exemplo n.º 13
0
    def create(cls, app_name='neutron'):

        # Setup logging early, supplying both the CLI options and the
        # configuration mapping from the config file
        # We only update the conf dict for the verbose and debug
        # flags. Everything else must be set up in the conf file...
        # Log the options used when starting if we're in debug mode...

        config.setup_logging(cfg.CONF)
        legacy.modernize_quantum_config(cfg.CONF)
        # Dump the initial option values
        cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
        service = cls(app_name)
        return service
Exemplo n.º 14
0
    def create(cls, app_name='neutron'):

        # Setup logging early, supplying both the CLI options and the
        # configuration mapping from the config file
        # We only update the conf dict for the verbose and debug
        # flags. Everything else must be set up in the conf file...
        # Log the options used when starting if we're in debug mode...

        config.setup_logging(cfg.CONF)
        legacy.modernize_quantum_config(cfg.CONF)
        # Dump the initial option values
        cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
        service = cls(app_name)
        return service
Exemplo n.º 15
0
 def initialize_app(self, argv):
     super(NeutronDebugShell, self).initialize_app(argv)
     if not self.options.config_file:
         raise exc.CommandError(
             _("You must provide a config file for bridge -"
               " either --config-file or env[NEUTRON_TEST_CONFIG_FILE]"))
     client = self.client_manager.neutron
     cfg.CONF.register_opts(interface.OPTS)
     cfg.CONF.register_opts(NeutronDebugAgent.OPTS)
     config.register_root_helper(cfg.CONF)
     cfg.CONF(['--config-file', self.options.config_file])
     config.setup_logging(cfg.CONF)
     legacy.modernize_quantum_config(cfg.CONF)
     driver = importutils.import_object(cfg.CONF.interface_driver, cfg.CONF)
     self.debug_agent = NeutronDebugAgent(cfg.CONF, client, driver)
Exemplo n.º 16
0
 def initialize_app(self, argv):
     super(NeutronDebugShell, self).initialize_app(argv)
     if not self.options.config_file:
         raise exc.CommandError(
             _("You must provide a config file for bridge -"
               " either --config-file or env[NEUTRON_TEST_CONFIG_FILE]"))
     client = self.client_manager.neutron
     cfg.CONF.register_opts(interface.OPTS)
     cfg.CONF.register_opts(NeutronDebugAgent.OPTS)
     config.register_root_helper(cfg.CONF)
     cfg.CONF(['--config-file', self.options.config_file])
     config.setup_logging(cfg.CONF)
     legacy.modernize_quantum_config(cfg.CONF)
     driver = importutils.import_object(cfg.CONF.interface_driver, cfg.CONF)
     self.debug_agent = NeutronDebugAgent(cfg.CONF, client, driver)
Exemplo n.º 17
0
def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    # import interface options just in case the driver uses namespaces
    cfg.CONF.register_opts(interface.OPTS)
    config.register_interface_driver_opts_helper(cfg.CONF)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)

    cfg.CONF(project="neutron")
    config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)

    mgr = manager.LbaasAgentManager(cfg.CONF)
    svc = LbaasAgentService(host=cfg.CONF.host, topic=topics.LOADBALANCER_AGENT, manager=mgr)
    service.launch(svc).wait()
Exemplo n.º 18
0
def main(manager='neutron.agent.l3_agent.L3NATAgentWithStateReport'):
    eventlet.monkey_patch()
    conf = cfg.CONF
    conf.register_opts(L3NATAgent.OPTS)
    config.register_agent_state_opts_helper(conf)
    config.register_root_helper(conf)
    conf.register_opts(interface.OPTS)
    conf.register_opts(external_process.OPTS)
    conf(project='neutron')
    config.setup_logging(conf)
    legacy.modernize_quantum_config(conf)
    server = neutron_service.Service.create(
        binary='neutron-l3-agent',
        topic=topics.L3_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager=manager)
    service.launch(server).wait()
Exemplo n.º 19
0
def main(manager='neutron.agent.l3_agent.L3NATAgentWithStateReport'):
    eventlet.monkey_patch()
    conf = cfg.CONF
    conf.register_opts(L3NATAgent.OPTS)
    config.register_agent_state_opts_helper(conf)
    config.register_root_helper(conf)
    conf.register_opts(interface.OPTS)
    conf.register_opts(external_process.OPTS)
    conf(project='neutron')
    config.setup_logging(conf)
    legacy.modernize_quantum_config(conf)
    server = neutron_service.Service.create(
        binary='neutron-l3-agent',
        topic=topics.L3_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager=manager)
    service.launch(server).wait()
Exemplo n.º 20
0
def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    # import interface options just in case the driver uses namespaces
    cfg.CONF.register_opts(interface.OPTS)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)

    cfg.CONF(project='neutron')
    config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)

    mgr = manager.LbaasAgentManager(cfg.CONF)
    svc = LbaasAgentService(host=cfg.CONF.host,
                            topic=plugin_driver.TOPIC_LOADBALANCER_AGENT,
                            manager=mgr)
    service.launch(svc).wait()
Exemplo n.º 21
0
def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(ip_lib.OPTS)
    cfg.CONF(project='neutron')
    logging_config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)

    try:
        agent_config = create_agent_config_map(cfg.CONF)
    except ValueError as e:
        LOG.exception(_("%s Agent terminated!"), e)
        raise SystemExit(1)

    plugin = SdnveNeutronAgent(**agent_config)

    # Start everything.
    LOG.info(_("Agent initialized successfully, now running... "))
    plugin.daemon_loop()
Exemplo n.º 22
0
def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)

    cfg.CONF(project='neutron')
    config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)

    mgr = manager.LbaasAgentManager(cfg.CONF)
    svc = LbaasAgentService(
        host=mgr.agent_host,
        topic=plugin_driver.TOPIC_LOADBALANCER_AGENT,
        manager=mgr
    )
    service.launch(svc).wait()
Exemplo n.º 23
0
def main():
    eventlet.monkey_patch()
    cfg.CONF.register_opts(ip_lib.OPTS)
    cfg.CONF(project='neutron')
    logging_config.setup_logging(cfg.CONF)
    legacy.modernize_quantum_config(cfg.CONF)

    try:
        agent_config = create_agent_config_map(cfg.CONF)
    except ValueError as e:
        LOG.exception(_("%s Agent terminated!"), e)
        raise SystemExit(1)

    plugin = SdnveNeutronAgent(**agent_config)

    # Start everything.
    LOG.info(_("Agent initialized successfully, now running... "))
    plugin.daemon_loop()
Exemplo n.º 24
0
def main():
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)

    if preJuno:
        cfg.CONF(project='neutron')
        config.setup_logging(cfg.CONF)
        legacy.modernize_quantum_config(cfg.CONF)
    else:
        common_config.init(sys.argv[1:])
        config.setup_logging()

    mgr = manager.LbaasAgentManager(cfg.CONF)
    svc = LbaasAgentService(host=mgr.agent_host,
                            topic=lbaasconstants.TOPIC_LOADBALANCER_AGENT,
                            manager=mgr)
    service.launch(svc).wait()
Exemplo n.º 25
0
def main():
    eventlet.monkey_patch()
    conf = cfg.CONF
    conf.register_opts(firewall_netconf_agent.OPTS)
    config.register_interface_driver_opts_helper(conf)
    config.register_use_namespaces_opts_helper(conf)
    config.register_agent_state_opts_helper(conf)
    config.register_root_helper(conf)
    conf.register_opts(interface.OPTS)
    conf.register_opts(external_process.OPTS)
    conf(project='neutron')
    config.setup_logging(conf)
    legacy.modernize_quantum_config(conf)
    server = neutron_service.Service.create(
        binary='neutron-FW-appliance-aS',
        topic=topics.L3_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron.services.firewall.agents.fw_netconf.fw_agent_bkp.'
                'NetconfFirewallAgentWithStateReport')
    service.launch(server).wait()
Exemplo n.º 26
0
    def __init__(self, options=None, config_file=None):
        # If no options have been provided, create an empty dict
        if not options:
            options = {}

        msg = validate_pre_plugin_load()
        if msg:
            LOG.critical(msg)
            raise Exception(msg)

        # NOTE(jkoelker) Testing for the subclass with the __subclasshook__
        #                breaks tach monitoring. It has been removed
        #                intentianally to allow v2 plugins to be monitored
        #                for performance metrics.
        plugin_provider = cfg.CONF.core_plugin
        LOG.debug(_("Plugin location: %s"), plugin_provider)
        # If the plugin can't be found let them know gracefully
        try:
            LOG.info(_("Loading Plugin: %s"), plugin_provider)
            plugin_klass = importutils.import_class(plugin_provider)
        except ImportError:
            LOG.exception(_("Error loading plugin"))
            raise Exception(_("Plugin not found. "))
        legacy.modernize_quantum_config(cfg.CONF)
        self.plugin = plugin_klass()

        msg = validate_post_plugin_load()
        if msg:
            LOG.critical(msg)
            raise Exception(msg)

        # core plugin as a part of plugin collection simplifies
        # checking extensions
        # TODO(enikanorov): make core plugin the same as
        # the rest of service plugins
        self.service_plugins = {constants.CORE: self.plugin}
        self._load_service_plugins()
Exemplo n.º 27
0
def main():
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    config.register_agent_state_opts_helper(cfg.CONF)
    config.register_root_helper(cfg.CONF)

    if preJuno:
        cfg.CONF(project='neutron')
        config.setup_logging(cfg.CONF)
        legacy.modernize_quantum_config(cfg.CONF)
    else:
        common_config.init(sys.argv[1:])
        config.setup_logging()

    mgr = manager.LbaasAgentManager(cfg.CONF)
    svc = LbaasAgentService(
        host=mgr.agent_host,
        topic=lbaasconstants.TOPIC_LOADBALANCER_AGENT,
        manager=mgr
    )
    if preLiberty:
        service.launch(svc).wait()
    else:
        service.launch(cfg.CONF, svc).wait()
Exemplo n.º 28
0
                            context.session.add(binding)
                            print('Pool %s is now bound to agent %s' %
                                  (pool.id, target_agent.id))
                            remapped_pools.append(pool.id)
                    context.session.flush()
        if need_target:
            print('Did not find another agent in env %s group %s' %
                  (env_prefix, env_group))
    else:
        print('No agent with id %s found.' % agent_id)


if __name__ == "__main__":

    OPTS = [cfg.StrOpt('agent_id', default=None)]

    cfg.CONF.register_cli_opts(opts=OPTS)

    if preJuno:
        config.setup_logging(cfg.CONF)
        legacy.modernize_quantum_config(cfg.CONF)
    else:
        common_config.init(sys.argv[1:])
        config.setup_logging()

    if cfg.CONF.agent_id is None:
        print_usage()
        sys.exit(1)

    rebind_pools(cfg.CONF.agent_id)
Exemplo n.º 29
0
        if need_target:
            print('Did not find another agent in env %s group %s'
                  % (env_prefix, env_group))
    else:
        print('No agent with id %s found.' % agent_id)


if __name__ == "__main__":

    OPTS = [
        cfg.StrOpt(
            'agent_id',
            default=None
        )
    ]

    cfg.CONF.register_cli_opts(opts=OPTS)

    if preJuno:
        config.setup_logging(cfg.CONF)
        legacy.modernize_quantum_config(cfg.CONF)
    else:
        common_config.init(sys.argv[1:])
        config.setup_logging()

    if cfg.CONF.agent_id is None:
        print_usage()
        sys.exit(1)

    rebind_pools(cfg.CONF.agent_id)