def main(): eventlet.monkey_patch() cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) interface_mappings = {} for mapping in cfg.CONF.LINUX_BRIDGE.physical_interface_mappings: try: physical_network, physical_interface = mapping.split(':') interface_mappings[physical_network] = physical_interface LOG.debug("physical network %s mapped to physical interface %s" % (physical_network, physical_interface)) except ValueError as ex: LOG.error("Invalid physical interface mapping: %s - %s. " "Agent terminated!" % (mapping, ex)) sys.exit(1) polling_interval = cfg.CONF.AGENT.polling_interval root_helper = cfg.CONF.AGENT.root_helper plugin = LinuxBridgeQuantumAgentRPC(interface_mappings, polling_interval, root_helper) LOG.info("Agent initialized successfully, now running... ") plugin.daemon_loop() sys.exit(0)
def main(): eventlet.monkey_patch() cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) interface_mappings = {} for mapping in cfg.CONF.LINUX_BRIDGE.physical_interface_mappings: try: physical_network, physical_interface = mapping.split(':') interface_mappings[physical_network] = physical_interface LOG.debug("physical network %s mapped to physical interface %s" % (physical_network, physical_interface)) except ValueError as ex: LOG.error("Invalid physical interface mapping: \'%s\' - %s" % (mapping, ex)) sys.exit(1) polling_interval = cfg.CONF.AGENT.polling_interval reconnect_interval = cfg.CONF.DATABASE.reconnect_interval root_helper = cfg.CONF.AGENT.root_helper rpc = cfg.CONF.AGENT.rpc if rpc: plugin = LinuxBridgeQuantumAgentRPC(interface_mappings, polling_interval, root_helper) else: db_connection_url = cfg.CONF.DATABASE.sql_connection plugin = LinuxBridgeQuantumAgentDB(interface_mappings, polling_interval, reconnect_interval, root_helper, db_connection_url) LOG.info("Agent initialized successfully, now running... ") plugin.daemon_loop() sys.exit(0)
def main(): cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) # Determine which agent type to use. enable_tunneling = cfg.CONF.OVS.enable_tunneling integ_br = cfg.CONF.OVS.integration_bridge db_connection_url = cfg.CONF.DATABASE.sql_connection polling_interval = cfg.CONF.AGENT.polling_interval reconnect_interval = cfg.CONF.DATABASE.reconnect_interval root_helper = cfg.CONF.AGENT.root_helper rpc = cfg.CONF.AGENT.rpc if enable_tunneling: # Get parameters for OVSQuantumTunnelAgent tun_br = cfg.CONF.OVS.tunnel_bridge # Mandatory parameter. local_ip = cfg.CONF.OVS.local_ip plugin = OVSQuantumTunnelAgent(integ_br, tun_br, local_ip, root_helper, polling_interval, reconnect_interval, rpc) else: # Get parameters for OVSQuantumAgent. plugin = OVSQuantumAgent(integ_br, root_helper, polling_interval, reconnect_interval, rpc) # Start everything. plugin.daemon_loop(db_connection_url) sys.exit(0)
def create(cls, conf=None, options=None, args=None): app_name = "quantum" if not conf: conf_file, conf = config.load_paste_config(app_name, options, args) if not conf: message = (_('No paste configuration found for: %s'), app_name) raise exception.Error(message) # 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(options, conf) debug = (options.get('debug') or config.get_option(conf, 'debug', type='bool', default=False)) verbose = (options.get('verbose') or config.get_option(conf, 'verbose', type='bool', default=False)) conf['debug'] = debug conf['verbose'] = verbose LOG.debug("*" * 80) LOG.debug("Configuration options gathered from config file:") LOG.debug(conf_file) LOG.debug("================================================") items = dict([(k, v) for k, v in conf.items() if k not in ('__file__', 'here')]) for key, value in sorted(items.items()): LOG.debug("%(key)-30s %(value)s" % locals()) LOG.debug("*" * 80) service = cls(app_name, conf_file, conf) return service
def main(): """Main method for cleaning up OVS bridges. The utility cleans up the integration bridges used by Quantum. """ conf = setup_conf() conf() config.setup_logging(conf) configuration_bridges = set( [conf.ovs_integration_bridge, conf.external_network_bridge]) ovs_bridges = set(ovs_lib.get_bridges(conf.AGENT.root_helper)) available_configuration_bridges = configuration_bridges & ovs_bridges if conf.ovs_all_ports: bridges = ovs_bridges else: bridges = available_configuration_bridges # Collect existing ports created by Quantum on configuration bridges. # After deleting ports from OVS bridges, we cannot determine which # ports were created by Quantum, so port information is collected now. ports = collect_quantum_ports(available_configuration_bridges, conf.AGENT.root_helper) for bridge in bridges: LOG.info(_("Cleaning %s"), bridge) ovs = ovs_lib.OVSBridge(bridge, conf.AGENT.root_helper) ovs.delete_ports(all_ports=conf.ovs_all_ports) # Remove remaining ports created by Quantum (usually veth pair) delete_quantum_ports(ports, conf.AGENT.root_helper) LOG.info(_("OVS cleanup completed successfully"))
def main(): cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) # Determine which agent type to use. enable_tunneling = cfg.CONF.OVS.enable_tunneling integ_br = cfg.CONF.OVS.integration_bridge db_connection_url = cfg.CONF.DATABASE.sql_connection polling_interval = cfg.CONF.AGENT.polling_interval reconnect_interval = cfg.CONF.DATABASE.reconnect_interval root_helper = cfg.CONF.AGENT.root_helper # Determine API Version to use target_v2_api = cfg.CONF.AGENT.target_v2_api # Get parameters for OVSQuantumAgent. plugin = MetaOVSQuantumAgent(integ_br, root_helper, polling_interval, reconnect_interval, target_v2_api) # Start everything. plugin.daemon_loop(db_connection_url) sys.exit(0)
def main(): eventlet.monkey_patch() cfg.CONF(project='quantum') logging_config.setup_logging(cfg.CONF) try: interface_mappings = q_utils.parse_mappings( cfg.CONF.ESWITCH.physical_interface_mappings) except ValueError as e: LOG.error( _("Parsing physical_interface_mappings failed: %s." " Agent terminated!"), e) sys.exit(1) LOG.info(_("Interface mappings: %s"), interface_mappings) try: agent = MlnxEswitchQuantumAgent(interface_mappings) except Exception as e: LOG.error( _("Failed on Agent initialisation : %s." " Agent terminated!"), e) sys.exit(1) # Start everything. LOG.info(_("Agent initialised successfully, now running... ")) agent.daemon_loop() sys.exit(0)
def main(): """Main method for cleaning up network namespaces. This method will make two passes checking for namespaces to delete. The process will identify candidates, sleep, and call garbage collect. The garbage collection will re-verify that the namespace meets the criteria for deletion (ie it is empty). The period of sleep and the 2nd pass allow time for the namespace state to settle, so that the check prior deletion will re-confirm the namespace is empty. The utility is designed to clean-up after the forced or unexpected termination of Quantum agents. The --force flag should only be used as part of the cleanup of a devstack installation as it will blindly purge namespaces and their devices. This option also kills any lingering DHCP instances. """ eventlet.monkey_patch() conf = setup_conf() conf() config.setup_logging(conf) root_helper = agent_config.get_root_helper(conf) # Identify namespaces that are candidates for deletion. candidates = [ns for ns in ip_lib.IPWrapper.get_namespaces(root_helper) if eligible_for_deletion(conf, ns, conf.force)] if candidates: eventlet.sleep(2) for namespace in candidates: destroy_namespace(conf, namespace, conf.force)
def main(): eventlet.monkey_patch() opts = [ cfg.StrOpt('network_id'), cfg.StrOpt('router_id'), cfg.StrOpt('pid_file'), cfg.BoolOpt('daemonize', default=True), cfg.IntOpt('metadata_port', default=9697, help=_("TCP Port to listen for metadata server " "requests.")), ] cfg.CONF.register_cli_opts(opts) # Don't get the default configuration file cfg.CONF(project='quantum', default_config_files=[]) config.setup_logging(cfg.CONF) utils.log_opt_values(LOG) proxy = ProxyDaemon(cfg.CONF.pid_file, cfg.CONF.metadata_port, network_id=cfg.CONF.network_id, router_id=cfg.CONF.router_id) if cfg.CONF.daemonize: proxy.start() else: proxy.run()
def main(): eventlet.monkey_patch() opts = [ cfg.StrOpt('network_id'), cfg.StrOpt('router_id'), cfg.StrOpt('pid_file'), cfg.BoolOpt('daemonize', default=True), cfg.IntOpt('metadata_port', default=9697, help="TCP Port to listen for metadata server requests."), ] cfg.CONF.register_cli_opts(opts) cfg.CONF(project='quantum') config.setup_logging(cfg.CONF) proxy = ProxyDaemon(cfg.CONF.pid_file, cfg.CONF.metadata_port, network_id=cfg.CONF.network_id, router_id=cfg.CONF.router_id) if cfg.CONF.daemonize: proxy.start() else: proxy.run()
def main(): eventlet.monkey_patch() cfg.CONF(project='quantum') logging_config.setup_logging(cfg.CONF) integ_br = cfg.CONF.ovs.integration_bridge polling_interval = cfg.CONF.AGENT.polling_interval root_helper = cfg.CONF.AGENT.root_helper tunnel_ip = _get_tunnel_ip() LOG.debug(_('tunnel_ip %s'), tunnel_ip) ovsdb_port = cfg.CONF.ovs.ovsdb_port LOG.debug(_('ovsdb_port %s'), ovsdb_port) ovsdb_ip = _get_ovsdb_ip() LOG.debug(_('ovsdb_ip %s'), ovsdb_ip) try: agent = OVSQuantumOFPRyuAgent(integ_br, tunnel_ip, ovsdb_ip, ovsdb_port, polling_interval, root_helper) except httplib.HTTPException as e: LOG.error(_("Initialization failed: %s"), e) sys.exit(1) LOG.info( _("Ryu initialization on the node is done. " "Agent initialized successfully, now running...")) agent.daemon_loop() sys.exit(0)
def setup_conf(): """Setup the cfg for the clean up utility. Use separate setup_conf for the utility because there are many options from the main config that do not apply during clean-up. """ opts = [ cfg.BoolOpt('ovs_all_ports', default=False, help=_('True to delete all ports on all the OpenvSwitch ' 'bridges. False to delete ports created by ' 'Quantum on integration and external network ' 'bridges.')) ] agent_opts = [ cfg.StrOpt('root_helper', default='sudo'), ] conf = cfg.CommonConfigOpts() conf.register_cli_opts(opts) conf.register_opts(l3_agent.L3NATAgent.OPTS) conf.register_opts(interface.OPTS) conf.register_opts(agent_opts, 'AGENT') config.setup_logging(conf) return conf
def main(): eventlet.monkey_patch() opts = [ cfg.StrOpt('network_id'), cfg.StrOpt('router_id'), cfg.StrOpt('pid_file'), cfg.BoolOpt('daemonize', default=True), cfg.IntOpt('metadata_port', default=9697, help="TCP Port to listen for metadata server requests."), ] cfg.CONF.register_opts(opts) cfg.CONF(args=sys.argv, project='quantum') config.setup_logging(cfg.CONF) proxy = ProxyDaemon(cfg.CONF.pid_file, cfg.CONF.metadata_port, network_id=cfg.CONF.network_id, router_id=cfg.CONF.router_id) if cfg.CONF.daemonize: proxy.start() else: proxy.run()
def main(): eventlet.monkey_patch() cfg.CONF(project='quantum') logging_config.setup_logging(cfg.CONF) integ_br = cfg.CONF.OVS.integration_bridge polling_interval = cfg.CONF.AGENT.polling_interval root_helper = cfg.CONF.AGENT.root_helper tunnel_ip = _get_tunnel_ip() LOG.debug(_('tunnel_ip %s'), tunnel_ip) ovsdb_port = cfg.CONF.OVS.ovsdb_port LOG.debug(_('ovsdb_port %s'), ovsdb_port) ovsdb_ip = _get_ovsdb_ip() LOG.debug(_('ovsdb_ip %s'), ovsdb_ip) try: agent = OVSQuantumOFPRyuAgent(integ_br, tunnel_ip, ovsdb_ip, ovsdb_port, polling_interval, root_helper) except httplib.HTTPException as e: LOG.error(_("Initialization failed: %s"), e) sys.exit(1) LOG.info(_("Ryu initialization on the node is done. " "Agent initialized successfully, now running...")) agent.daemon_loop() sys.exit(0)
def main(): eventlet.monkey_patch() cfg.CONF(project='quantum') logging_config.setup_logging(cfg.CONF) try: interface_mappings = q_utils.parse_mappings( cfg.CONF.ESWITCH.physical_interface_mappings) except ValueError as e: LOG.error(_("Parsing physical_interface_mappings failed: %s." " Agent terminated!"), e) sys.exit(1) LOG.info(_("Interface mappings: %s"), interface_mappings) try: agent = MlnxEswitchQuantumAgent(interface_mappings) except Exception as e: LOG.error(_("Failed on Agent initialisation : %s." " Agent terminated!"), e) sys.exit(1) # Start everything. LOG.info(_("Agent initialised successfully, now running... ")) agent.daemon_loop() sys.exit(0)
def setup_conf(): """Setup the cfg for the clean up utility. Use separate setup_conf for the utility because there are many options from the main config that do not apply during clean-up. """ opts = [ cfg.StrOpt('root_helper', default='sudo', help=_("Root helper application.")), cfg.StrOpt('dhcp_driver', default='quantum.agent.linux.dhcp.Dnsmasq', help=_("The driver used to manage the DHCP server.")), cfg.StrOpt('state_path', default='.', help=_('Top-level directory for maintaining dhcp state')), cfg.BoolOpt('force', default=False, help=_('Delete the namespace by removing all devices.')), ] conf = cfg.CommonConfigOpts() conf.register_opts(opts) conf.register_opts(dhcp.OPTS) config.setup_logging(conf) return conf
def main(): cfg.CONF(args=sys.argv, project="quantum") # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) br_name_prefix = BRIDGE_NAME_PREFIX physical_interface = cfg.CONF.LINUX_BRIDGE.physical_interface polling_interval = cfg.CONF.AGENT.polling_interval reconnect_interval = cfg.CONF.DATABASE.reconnect_interval root_helper = cfg.CONF.AGENT.root_helper rpc = cfg.CONF.AGENT.rpc if not cfg.CONF.AGENT.target_v2_api: rpc = False if rpc: plugin = LinuxBridgeQuantumAgentRPC(br_name_prefix, physical_interface, polling_interval, root_helper) else: db_connection_url = cfg.CONF.DATABASE.sql_connection target_v2_api = cfg.CONF.AGENT.target_v2_api plugin = LinuxBridgeQuantumAgentDB( br_name_prefix, physical_interface, polling_interval, reconnect_interval, root_helper, target_v2_api, db_connection_url, ) LOG.info("Agent initialized successfully, now running... ") plugin.daemon_loop() sys.exit(0)
def main(): cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) integ_br = cfg.CONF.OVS.integration_bridge root_helper = cfg.CONF.AGENT.root_helper options = {"sql_connection": cfg.CONF.DATABASE.sql_connection} db = SqlSoup(options["sql_connection"]) LOG.info( _("Connecting to database \"%(database)s\" on %(host)s") % { "database": db.engine.url.database, "host": db.engine.url.host }) ofp_rest_api_addr = check_ofp_rest_api_addr(db) tunnel_ip = _get_tunnel_ip() LOG.debug(_('tunnel_ip %s'), tunnel_ip) ovsdb_port = cfg.CONF.OVS.ovsdb_port LOG.debug(_('ovsdb_port %s'), ovsdb_port) ovsdb_ip = _get_ovsdb_ip() LOG.debug(_('ovsdb_ip %s'), ovsdb_ip) try: OVSQuantumOFPRyuAgent(integ_br, ofp_rest_api_addr, tunnel_ip, ovsdb_ip, ovsdb_port, root_helper) except httplib.HTTPException, e: LOG.error(_("initialization failed: %s"), e) sys.exit(1)
def main(): """Main method for cleaning up OVS bridges. The utility cleans up the integration bridges used by Quantum. """ conf = setup_conf() conf() config.setup_logging(conf) configuration_bridges = set([conf.ovs_integration_bridge, conf.external_network_bridge]) ovs_bridges = set(ovs_lib.get_bridges(conf.AGENT.root_helper)) available_configuration_bridges = configuration_bridges & ovs_bridges if conf.ovs_all_ports: bridges = ovs_bridges else: bridges = available_configuration_bridges # Collect existing ports created by Quantum on configuration bridges. # After deleting ports from OVS bridges, we cannot determine which # ports were created by Quantum, so port information is collected now. ports = collect_quantum_ports(available_configuration_bridges, conf.AGENT.root_helper) for bridge in bridges: LOG.info(_("Cleaning %s"), bridge) ovs = ovs_lib.OVSBridge(bridge, conf.AGENT.root_helper) ovs.delete_ports(all_ports=conf.ovs_all_ports) # Remove remaining ports created by Quantum (usually veth pair) delete_quantum_ports(ports, conf.AGENT.root_helper) LOG.info(_("OVS cleanup completed successfully"))
def create(cls, conf=None, options=None, args=None): app_name = "quantum" if not conf: conf_file, conf = config.load_paste_config(app_name, options, args) if not conf: message = (_('No paste configuration found for: %s'), app_name) raise exception.Error(message) # 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(options, conf) debug = (options.get('debug') or config.get_option( conf, 'debug', type='bool', default=False)) verbose = (options.get('verbose') or config.get_option( conf, 'verbose', type='bool', default=False)) conf['debug'] = debug conf['verbose'] = verbose LOG.debug("*" * 80) LOG.debug("Configuration options gathered from config file:") LOG.debug(conf_file) LOG.debug("================================================") items = dict([(k, v) for k, v in conf.items() if k not in ('__file__', 'here')]) for key, value in sorted(items.items()): LOG.debug("%(key)-30s %(value)s" % { 'key': key, 'value': value, }) LOG.debug("*" * 80) service = cls(app_name, conf_file, conf) return service
def main(): eventlet.monkey_patch() cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) try: interface_mappings = q_utils.parse_mappings( cfg.CONF.LINUX_BRIDGE.physical_interface_mappings) except ValueError as e: LOG.error(_("Parsing physical_interface_mappings failed: %s." " Agent terminated!"), e) sys.exit(1) LOG.info(_("Interface mappings: %s") % interface_mappings) polling_interval = cfg.CONF.AGENT.polling_interval reconnect_interval = cfg.CONF.DATABASE.reconnect_interval root_helper = cfg.CONF.AGENT.root_helper rpc = cfg.CONF.AGENT.rpc if rpc: plugin = LinuxBridgeQuantumAgentRPC(interface_mappings, polling_interval, root_helper) else: db_connection_url = cfg.CONF.DATABASE.sql_connection plugin = LinuxBridgeQuantumAgentDB(interface_mappings, polling_interval, reconnect_interval, root_helper, db_connection_url) LOG.info("Agent initialized successfully, now running... ") plugin.daemon_loop() sys.exit(0)
def main(): cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) integ_br = cfg.CONF.OVS.integration_bridge root_helper = cfg.CONF.AGENT.root_helper options = {"sql_connection": cfg.CONF.DATABASE.sql_connection} db = SqlSoup(options["sql_connection"]) LOG.info(_("Connecting to database \"%(database)s\" on %(host)s"), {"database": db.engine.url.database, "host": db.engine.url.host}) ofp_rest_api_addr = check_ofp_rest_api_addr(db) tunnel_ip = _get_tunnel_ip() LOG.debug(_('tunnel_ip %s'), tunnel_ip) ovsdb_port = cfg.CONF.OVS.ovsdb_port LOG.debug(_('ovsdb_port %s'), ovsdb_port) ovsdb_ip = _get_ovsdb_ip() LOG.debug(_('ovsdb_ip %s'), ovsdb_ip) try: OVSQuantumOFPRyuAgent(integ_br, ofp_rest_api_addr, tunnel_ip, ovsdb_ip, ovsdb_port, root_helper) except httplib.HTTPException, e: LOG.error(_("Initialization failed: %s"), e) sys.exit(1)
def main(): eventlet.monkey_patch() cfg.CONF.register_opts(UnixDomainMetadataProxy.OPTS) cfg.CONF.register_opts(MetadataProxyHandler.OPTS) cfg.CONF(project='quantum') config.setup_logging(cfg.CONF) utils.log_opt_values(LOG) proxy = UnixDomainMetadataProxy(cfg.CONF) proxy.run()
def main(): eventlet.monkey_patch() cfg.CONF.register_opts(UnixDomainMetadataProxy.OPTS) cfg.CONF.register_opts(MetadataProxyHandler.OPTS) cfg.CONF(project='quantum') config.setup_logging(cfg.CONF) proxy = UnixDomainMetadataProxy(cfg.CONF) proxy.run()
def main(): eventlet.monkey_patch() cfg.CONF.register_opts(UnixDomainMetadataProxy.OPTS) cfg.CONF.register_opts(MetadataProxyHandler.OPTS) cfg.CONF(args=sys.argv, project='quantum') config.setup_logging(cfg.CONF) proxy = UnixDomainMetadataProxy(cfg.CONF) proxy.run()
def main(): eventlet.monkey_patch() cfg.CONF(project='quantum') logging_config.setup_logging(cfg.CONF) plugin = HyperVQuantumAgent() # Start everything. LOG.info(_("Agent initialized successfully, now running... ")) plugin.daemon_loop() sys.exit(0)
def main(): eventlet.monkey_patch() cfg.CONF(args=sys.argv[1:], project='quantum') logging_config.setup_logging(cfg.CONF) plugin = HyperVQuantumAgent() # Start everything. LOG.info(_("Agent initialized successfully, now running... ")) plugin.daemon_loop() sys.exit(0)
def create(cls): app_name = "quantum" # 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) # Dump the initial option values cfg.CONF.log_opt_values(LOG, std_logging.DEBUG) service = cls(app_name) return service
def main(): eventlet.monkey_patch() config.CONF(project='quantum') logging_config.setup_logging(config.CONF) # Determine which agent type to use. integ_br = config.OVS.integration_bridge root_helper = config.AGENT.root_helper polling_interval = config.AGENT.polling_interval agent = NECQuantumAgent(integ_br, root_helper, polling_interval) # Start everything. agent.daemon_loop()
def main(): config.CONF(args=sys.argv, project="quantum") logging_config.setup_logging(config.CONF) # Determine which agent type to use. integ_br = config.OVS.integration_bridge root_helper = config.AGENT.root_helper polling_interval = config.AGENT.polling_interval agent = NECQuantumAgent(integ_br, root_helper, polling_interval) # Start everything. agent.daemon_loop() sys.exit(0)
def main(): eventlet.monkey_patch() cfg.CONF(project='quantum') logging_config.setup_logging(cfg.CONF) try: agent_config = create_agent_config_map(cfg.CONF) except ValueError as e: LOG.error(_('%s Agent terminated!'), e) sys.exit(1) plugin = OVSQuantumAgent(**agent_config) # Start everything. LOG.info(_("Agent initialized successfully, now running... ")) plugin.daemon_loop() sys.exit(0)
def main(): eventlet.monkey_patch() cfg.CONF(args=sys.argv, project='quantum') logging_config.setup_logging(cfg.CONF) try: agent_config = create_agent_config_map(cfg.CONF) except ValueError as e: LOG.error('%s Agent terminated!', e) sys.exit(1) plugin = OVSQuantumAgent(**agent_config) # Start everything. LOG.info("Agent initialized successfully, now running... ") plugin.daemon_loop() sys.exit(0)
def main(): cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) integ_br = cfg.CONF.OVS.integration_bridge root_helper = cfg.CONF.AGENT.root_helper options = {"sql_connection": cfg.CONF.DATABASE.sql_connection} db = SqlSoup(options["sql_connection"]) LOG.info("Connecting to database \"%s\" on %s", db.engine.url.database, db.engine.url.host) plugin = OVSQuantumOFPRyuAgent(integ_br, db, root_helper) plugin.daemon_loop(db) sys.exit(0)
def main(): eventlet.monkey_patch() cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) integ_br = cfg.CONF.OVS.integration_bridge db_connection_url = cfg.CONF.DATABASE.sql_connection polling_interval = cfg.CONF.AGENT.polling_interval reconnect_interval = cfg.CONF.DATABASE.reconnect_interval root_helper = cfg.CONF.AGENT.root_helper rpc = cfg.CONF.AGENT.rpc tun_br = cfg.CONF.OVS.tunnel_bridge local_ip = cfg.CONF.OVS.local_ip enable_tunneling = cfg.CONF.OVS.enable_tunneling if enable_tunneling and not local_ip: LOG.error("Invalid local_ip. (%s). " "Agent terminated!" % repr(local_ip)) sys.exit(1) bridge_mappings = {} for mapping in cfg.CONF.OVS.bridge_mappings: mapping = mapping.strip() if mapping != '': try: physical_network, bridge = mapping.split(':') bridge_mappings[physical_network] = bridge LOG.info("Physical network %s mapped to bridge %s", physical_network, bridge) except ValueError as ex: LOG.error( "Invalid bridge mapping: %s - %s. " "Agent terminated!", mapping, ex) sys.exit(1) plugin = OVSQuantumAgent(integ_br, tun_br, local_ip, bridge_mappings, root_helper, polling_interval, reconnect_interval, rpc, enable_tunneling) # Start everything. LOG.info("Agent initialized successfully, now running... ") plugin.daemon_loop(db_connection_url) sys.exit(0)
def main(): eventlet.monkey_patch() cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) integ_br = cfg.CONF.OVS.integration_bridge db_connection_url = cfg.CONF.DATABASE.sql_connection polling_interval = cfg.CONF.AGENT.polling_interval reconnect_interval = cfg.CONF.DATABASE.reconnect_interval root_helper = cfg.CONF.AGENT.root_helper rpc = cfg.CONF.AGENT.rpc tun_br = cfg.CONF.OVS.tunnel_bridge local_ip = cfg.CONF.OVS.local_ip enable_tunneling = cfg.CONF.OVS.enable_tunneling if enable_tunneling and not local_ip: LOG.error("Invalid local_ip. (%s). " "Agent terminated!" % repr(local_ip)) sys.exit(1) bridge_mappings = {} for mapping in cfg.CONF.OVS.bridge_mappings: mapping = mapping.strip() if mapping != '': try: physical_network, bridge = mapping.split(':') bridge_mappings[physical_network] = bridge LOG.info("Physical network %s mapped to bridge %s", physical_network, bridge) except ValueError as ex: LOG.error("Invalid bridge mapping: %s - %s. " "Agent terminated!", mapping, ex) sys.exit(1) plugin = OVSQuantumAgent(integ_br, tun_br, local_ip, bridge_mappings, root_helper, polling_interval, reconnect_interval, rpc, enable_tunneling) # Start everything. LOG.info("Agent initialized successfully, now running... ") plugin.daemon_loop(db_connection_url) sys.exit(0)
def main(): eventlet.monkey_patch() cfg.CONF(project="quantum") logging_config.setup_logging(cfg.CONF) try: interface_mappings = q_utils.parse_mappings(cfg.CONF.LINUX_BRIDGE.physical_interface_mappings) except ValueError as e: LOG.error(_("Parsing physical_interface_mappings failed: %s." " Agent terminated!"), e) sys.exit(1) LOG.info(_("Interface mappings: %s"), interface_mappings) polling_interval = cfg.CONF.AGENT.polling_interval root_helper = cfg.CONF.AGENT.root_helper plugin = LinuxBridgeQuantumAgentRPC(interface_mappings, polling_interval, root_helper) LOG.info(_("Agent initialized successfully, now running... ")) plugin.daemon_loop() sys.exit(0)
def setup_conf(): """Setup the cfg for the clean up utility. Use separate setup_conf for the utility because there are many options from the main config that do not apply during clean-up. """ opts = [ cfg.BoolOpt('ovs_all_ports', default=False, help='True deletes all ports on the bridge. False deletes ' 'those created by Quantum.'), ] conf = cfg.CommonConfigOpts() conf.register_opts(opts) conf.register_opts(l3_agent.L3NATAgent.OPTS) conf.register_opts(interface.OPTS) config.setup_logging(conf) return conf
def main(): eventlet.monkey_patch() cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) integ_br = cfg.CONF.RGOS.integration_bridge db_connection_url = cfg.CONF.DATABASE.sql_connection polling_interval = cfg.CONF.AGENT.polling_interval reconnect_interval = cfg.CONF.DATABASE.reconnect_interval root_helper = cfg.CONF.AGENT.root_helper rpc = cfg.CONF.AGENT.rpc local_ip = cfg.CONF.RGOS.local_ip lldp_timeout = cfg.CONF.AGENT.lldp_timeout options = {"sql_connection": db_connection_url} options.update({"sql_max_retries": -1}) options.update({"reconnect_interval": reconnect_interval}) db.configure_db(options) bridge_mappings = {} for mapping in cfg.CONF.RGOS.bridge_mappings: mapping = mapping.strip() if mapping != '': try: physical_network, bridge = mapping.split(':') bridge_mappings[physical_network] = bridge LOG.info("Physical network %s mapped to bridge %s", physical_network, bridge) except ValueError as ex: LOG.error("Invalid bridge mapping: \'%s\' - %s", mapping, ex) sys.exit(1) plugin = OVSQuantumAgent(integ_br, local_ip, bridge_mappings, root_helper, polling_interval, reconnect_interval, lldp_timeout, rpc) # Start everything. plugin.daemon_loop(db_connection_url) sys.exit(0)
def main(): cfg.CONF(project='quantum') logging_config.setup_logging(cfg.CONF) integ_br = cfg.CONF.OVS.integration_bridge root_helper = cfg.CONF.AGENT.root_helper tunnel_ip = _get_tunnel_ip() LOG.debug(_('tunnel_ip %s'), tunnel_ip) ovsdb_port = cfg.CONF.OVS.ovsdb_port LOG.debug(_('ovsdb_port %s'), ovsdb_port) ovsdb_ip = _get_ovsdb_ip() LOG.debug(_('ovsdb_ip %s'), ovsdb_ip) try: OVSQuantumOFPRyuAgent(integ_br, tunnel_ip, ovsdb_ip, ovsdb_port, root_helper) except httplib.HTTPException, e: LOG.error(_("Initialization failed: %s"), e) sys.exit(1)
def main(): cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) br_name_prefix = BRIDGE_NAME_PREFIX physical_interface = cfg.CONF.LINUX_BRIDGE.physical_interface polling_interval = cfg.CONF.AGENT.polling_interval reconnect_interval = cfg.CONF.DATABASE.reconnect_interval root_helper = cfg.CONF.AGENT.root_helper 'Establish database connection and load models' db_connection_url = cfg.CONF.DATABASE.sql_connection plugin = LinuxBridgeQuantumAgent(br_name_prefix, physical_interface, polling_interval, reconnect_interval, root_helper, cfg.CONF.AGENT.target_v2_api) LOG.info("Agent initialized successfully, now running... ") plugin.daemon_loop(db_connection_url) sys.exit(0)
def main(): eventlet.monkey_patch() cfg.CONF(project='quantum') logging_config.setup_logging(cfg.CONF) try: interface_mappings = q_utils.parse_mappings( cfg.CONF.LINUX_BRIDGE.physical_interface_mappings) except ValueError as e: LOG.error(_("Parsing physical_interface_mappings failed: %s." " Agent terminated!"), e) sys.exit(1) LOG.info(_("Interface mappings: %s"), interface_mappings) polling_interval = cfg.CONF.AGENT.polling_interval root_helper = cfg.CONF.AGENT.root_helper plugin = LinuxBridgeQuantumAgentRPC(interface_mappings, polling_interval, root_helper) LOG.info(_("Agent initialized successfully, now running... ")) plugin.daemon_loop() sys.exit(0)
def create(cls): app_name = "quantum" # 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) LOG.debug("*" * 80) LOG.debug("Configuration options gathered from config file:") LOG.debug("================================================") items = dict([(k, v) for k, v in cfg.CONF.items() if k not in ('__file__', 'here')]) for key, value in sorted(items.items()): LOG.debug("%(key)-30s %(value)s" % {'key': key, 'value': value, }) LOG.debug("*" * 80) service = cls(app_name) return service
def main(): eventlet.monkey_patch() cfg.CONF(args=sys.argv, project='quantum') # (TODO) gary - swap with common logging logging_config.setup_logging(cfg.CONF) integ_br = cfg.CONF.OVS.integration_bridge db_connection_url = cfg.CONF.DATABASE.sql_connection polling_interval = cfg.CONF.AGENT.polling_interval reconnect_interval = cfg.CONF.DATABASE.reconnect_interval root_helper = cfg.CONF.AGENT.root_helper rpc = cfg.CONF.AGENT.rpc tun_br = cfg.CONF.OVS.tunnel_bridge local_ip = cfg.CONF.OVS.local_ip bridge_mappings = {} for mapping in cfg.CONF.OVS.bridge_mappings: mapping = mapping.strip() if mapping != '': try: physical_network, bridge = mapping.split(':') bridge_mappings[physical_network] = bridge LOG.debug("physical network %s mapped to bridge %s" % (physical_network, bridge)) except ValueError as ex: LOG.error("Invalid bridge mapping: \'%s\' - %s" % (mapping, ex)) sys.exit(1) plugin = OVSQuantumAgent(integ_br, tun_br, local_ip, bridge_mappings, root_helper, polling_interval, reconnect_interval, rpc) # Start everything. plugin.daemon_loop(db_connection_url) sys.exit(0)
def create(cls): app_name = "quantum" # 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) LOG.debug("*" * 80) LOG.debug("Configuration options gathered from config file:") LOG.debug("================================================") items = dict([(k, v) for k, v in cfg.CONF.items() if k not in ('__file__', 'here')]) for key, value in sorted(items.items()): LOG.debug("%(key)-30s %(value)s" % { 'key': key, 'value': value, }) LOG.debug("*" * 80) service = cls(app_name) return service
def main(): eventlet.monkey_patch() cfg.CONF(project='quantum') logging_config.setup_logging(cfg.CONF) integ_br = cfg.CONF.OVS.integration_bridge polling_interval = cfg.CONF.AGENT.polling_interval root_helper = cfg.CONF.AGENT.root_helper tunnel_ip = _get_tunnel_ip() LOG.debug(_('tunnel_ip %s'), tunnel_ip) ovsdb_port = cfg.CONF.OVS.ovsdb_port LOG.debug(_('ovsdb_port %s'), ovsdb_port) ovsdb_ip = _get_ovsdb_ip() LOG.debug(_('ovsdb_ip %s'), ovsdb_ip) try: agent = OVSQuantumOFPRyuAgent(integ_br, tunnel_ip, ovsdb_ip, ovsdb_port, polling_interval, root_helper) except httplib.HTTPException, e: LOG.error(_("Initialization failed: %s"), e) sys.exit(1)
def main(): eventlet.monkey_patch() cfg.CONF(project='quantum') cfg.CONF.register_opts(ip_lib.OPTS) logging_config.setup_logging(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 = OVSQuantumAgent(**agent_config) # Start everything. LOG.info(_("Agent initialized successfully, now running... ")) plugin.daemon_loop() sys.exit(0)
def setup_conf(): """Setup the cfg for the clean up utility. Use separate setup_conf for the utility because there are many options from the main config that do not apply during clean-up. """ opts = [ cfg.StrOpt('root_helper', default='sudo'), cfg.StrOpt('dhcp_driver', default='quantum.agent.linux.dhcp.Dnsmasq', help="The driver used to manage the DHCP server."), cfg.StrOpt('state_path', default='.', help='Top-level directory for maintaining dhcp state'), cfg.BoolOpt('force', default=False, help='Delete the namespace by removing all devices.'), ] conf = cfg.CommonConfigOpts() conf.register_opts(opts) conf.register_opts(dhcp.OPTS) config.setup_logging(conf) return conf
# License for the specific language governing permissions and limitations # under the License. # # # @author: Aaron Rosen, VMware import sys from oslo.config import cfg from quantum.common import config from quantum.plugins.nicira.nicira_nvp_plugin import NvpApiClient from quantum.plugins.nicira.nicira_nvp_plugin import nvplib from quantum.plugins.nicira.nicira_nvp_plugin import QuantumPlugin config.setup_logging(cfg.CONF) def help(): print "Usage ./check_nvp_config path/to/nvp.ini" exit(1) def display_controller_info(controller): print "\tCan login: %s" % controller.get('can_login') print "\tuser: %s" % controller.get('user') print "\tpassword: %s" % controller.get('password') print "\tip: %s" % controller.get('ip') print "\tport: %s" % controller.get('port') print "\trequested_timeout: %s" % controller.get('requested_timeout') print "\tretires: %s" % controller.get('retries')