Exemple #1
0
    def __init__(self):
        LOG.info(_('QuantumRestProxy: Starting plugin. Version=%s'),
                 version_string_with_vcs())

        # init DB, proxy's persistent store defaults to in-memory sql-lite DB
        options = {"sql_connection": "%s" % cfg.CONF.DATABASE.sql_connection,
                   "sql_max_retries": cfg.CONF.DATABASE.sql_max_retries,
                   "reconnect_interval": cfg.CONF.DATABASE.reconnect_interval,
                   "base": models_v2.model_base.BASEV2,
                   "sql_min_pool_size": cfg.CONF.DATABASE.sql_min_pool_size,
                   "sql_max_pool_size": cfg.CONF.DATABASE.sql_max_pool_size,
                   "sql_idle_timeout": cfg.CONF.DATABASE.sql_idle_timeout,
                   "sql_dbpool_enable": cfg.CONF.DATABASE.sql_dbpool_enable}
        db.configure_db(options)

        # 'servers' is the list of network controller REST end-points
        # (used in order specified till one suceeds, and it is sticky
        # till next failure). Use 'serverauth' to encode api-key
        servers = cfg.CONF.RESTPROXY.servers
        serverauth = cfg.CONF.RESTPROXY.serverauth
        serverssl = cfg.CONF.RESTPROXY.serverssl
        syncdata = cfg.CONF.RESTPROXY.syncdata
        timeout = cfg.CONF.RESTPROXY.servertimeout

        # validate config
        assert servers is not None, 'Servers not defined. Aborting plugin'
        servers = tuple(s.rsplit(':', 1) for s in servers.split(','))
        servers = tuple((server, int(port)) for server, port in servers)
        assert all(len(s) == 2 for s in servers), SYNTAX_ERROR_MESSAGE

        # init network ctrl connections
        self.servers = ServerPool(servers, serverssl, serverauth,
                                  timeout)

        # init dhcp support
        self.topic = topics.PLUGIN
        self.conn = rpc.create_connection(new=True)
        self.callbacks = RpcProxy()
        self.dispatcher = self.callbacks.create_rpc_dispatcher()
        self.conn.create_consumer(self.topic, self.dispatcher,
                                  fanout=False)
        # Consume from all consumers in a thread
        self.conn.consume_in_thread()
        if syncdata:
            self._send_all_data()

        LOG.debug(_("QuantumRestProxyV2: initialization done"))
Exemple #2
0
    def __init__(self):
        LOG.info('QuantumRestProxy: Starting plugin. Version=%s' %
                 version_string_with_vcs())

        # init DB, proxy's persistent store defaults to in-memory sql-lite DB
        options = {
            "sql_connection": "%s" % cfg.CONF.DATABASE.sql_connection,
            "sql_max_retries": cfg.CONF.DATABASE.sql_max_retries,
            "reconnect_interval": cfg.CONF.DATABASE.reconnect_interval,
            "base": models_v2.model_base.BASEV2
        }
        db.configure_db(options)

        # 'servers' is the list of network controller REST end-points
        # (used in order specified till one suceeds, and it is sticky
        # till next failure). Use 'serverauth' to encode api-key
        servers = cfg.CONF.RESTPROXY.servers
        serverauth = cfg.CONF.RESTPROXY.serverauth
        serverssl = cfg.CONF.RESTPROXY.serverssl
        syncdata = cfg.CONF.RESTPROXY.syncdata
        timeout = cfg.CONF.RESTPROXY.servertimeout

        # validate config
        assert servers is not None, 'Servers not defined. Aborting plugin'
        servers = tuple(s.rsplit(':', 1) for s in servers.split(','))
        servers = tuple((server, int(port)) for server, port in servers)
        assert all(len(s) == 2 for s in servers), SYNTAX_ERROR_MESSAGE

        # init network ctrl connections
        self.servers = ServerPool(servers, serverssl, serverauth, timeout)

        # init dhcp support
        self.topic = topics.PLUGIN
        self.rpc_context = glbcontext.RequestContext('quantum',
                                                     'quantum',
                                                     is_admin=False)
        self.conn = rpc.create_connection(new=True)
        self.callbacks = RpcProxy(self.rpc_context)
        self.dispatcher = self.callbacks.create_rpc_dispatcher()
        self.conn.create_consumer(self.topic, self.dispatcher, fanout=False)
        # Consume from all consumers in a thread
        self.conn.consume_in_thread()
        if syncdata:
            self._send_all_data()

        LOG.debug("QuantumRestProxyV2: initialization done")
Exemple #3
0
    def __init__(self):
        LOG.info(_("QuantumRestProxy: Starting plugin. Version=%s"), version_string_with_vcs())

        # init DB, proxy's persistent store defaults to in-memory sql-lite DB
        db.configure_db()

        # 'servers' is the list of network controller REST end-points
        # (used in order specified till one suceeds, and it is sticky
        # till next failure). Use 'server_auth' to encode api-key
        servers = cfg.CONF.RESTPROXY.servers
        server_auth = cfg.CONF.RESTPROXY.server_auth
        server_ssl = cfg.CONF.RESTPROXY.server_ssl
        sync_data = cfg.CONF.RESTPROXY.sync_data
        timeout = cfg.CONF.RESTPROXY.server_timeout
        quantum_id = cfg.CONF.RESTPROXY.quantum_id
        self.add_meta_server_route = cfg.CONF.RESTPROXY.add_meta_server_route

        # validate config
        assert servers is not None, "Servers not defined. Aborting plugin"
        servers = tuple(s.rsplit(":", 1) for s in servers.split(","))
        servers = tuple((server, int(port)) for server, port in servers)
        assert all(len(s) == 2 for s in servers), SYNTAX_ERROR_MESSAGE

        # init network ctrl connections
        self.servers = ServerPool(servers, server_ssl, server_auth, quantum_id, timeout, BASE_URI)

        # init dhcp support
        self.topic = topics.PLUGIN
        self.conn = rpc.create_connection(new=True)
        self.callbacks = RpcProxy()
        self.dispatcher = self.callbacks.create_rpc_dispatcher()
        self.conn.create_consumer(self.topic, self.dispatcher, fanout=False)
        # Consume from all consumers in a thread
        self.conn.consume_in_thread()
        if sync_data:
            self._send_all_data()

        self._dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
        LOG.debug(_("QuantumRestProxyV2: initialization done"))