Esempio n. 1
0
 def run(self):
     server = agent_utils.UnixDomainWSGIServer(
         'neutron-keepalived-state-change',
         num_threads=self.conf.ha_keepalived_state_change_server_threads)
     server.start(KeepalivedStateChangeHandler(self.agent),
                  self.get_keepalived_state_change_socket_path(self.conf),
                  workers=0,
                  backlog=KEEPALIVED_STATE_CHANGE_SERVER_BACKLOG)
     server.wait()
Esempio n. 2
0
 def run(self):
     server = agent_utils.UnixDomainWSGIServer('neutron-metadata-agent')
     server.start(MetadataProxyHandler(self.conf),
                  self.conf.metadata_proxy_socket,
                  workers=self.conf.metadata_workers,
                  backlog=self.conf.metadata_backlog,
                  mode=self._get_socket_mode())
     self._init_state_reporting()
     server.wait()
Esempio n. 3
0
    def test_run(self):
        self.server = utils.UnixDomainWSGIServer('test')
        self.server._run('app', 'sock')

        self.eventlet.wsgi.server.assert_called_once_with(
            'sock',
            'app',
            protocol=utils.UnixDomainHttpProtocol,
            log=mock.ANY,
            max_size=self.server.num_threads)
Esempio n. 4
0
 def run(self):
     server = agent_utils.UnixDomainWSGIServer(
         constants.AGENT_PROCESS_METADATA)
     server.start(MetadataProxyHandler(self.conf),
                  self.conf.metadata_proxy_socket,
                  workers=self.conf.metadata_workers,
                  backlog=self.conf.metadata_backlog,
                  mode=self._get_socket_mode())
     self._init_state_reporting()
     server.wait()
Esempio n. 5
0
 def test_start(self):
     self.server = utils.UnixDomainWSGIServer('test')
     mock_app = mock.Mock()
     with mock.patch.object(self.server, '_launch') as launcher:
         self.server.start(mock_app, '/the/path', workers=5, backlog=128)
         self.eventlet.assert_has_calls([
             mock.call.listen('/the/path',
                              family=socket.AF_UNIX,
                              backlog=128)
         ])
         launcher.assert_called_once_with(mock_app, workers=5)
Esempio n. 6
0
 def run(self):
     self.server = agent_utils.UnixDomainWSGIServer(
         'neutron-ovn-metadata-agent')
     # Set the default metadata_workers if not yet set in the config file
     md_workers = self.conf.metadata_workers
     if md_workers is None:
         md_workers = 2
     self.server.start(MetadataProxyHandler(self.conf),
                       self.conf.metadata_proxy_socket,
                       workers=md_workers,
                       backlog=self.conf.metadata_backlog,
                       mode=self._get_socket_mode())
Esempio n. 7
0
    def test_num_threads(self):
        num_threads = 8
        self.server = utils.UnixDomainWSGIServer('test',
                                                 num_threads=num_threads)
        self.server._run('app', 'sock')

        self.eventlet.wsgi.server.assert_called_once_with(
            'sock',
            'app',
            protocol=utils.UnixDomainHttpProtocol,
            log=mock.ANY,
            log_format=cfg.CONF.wsgi_log_format,
            max_size=num_threads)
Esempio n. 8
0
    def _create_metadata_fake_server(self, status):
        server = utils.UnixDomainWSGIServer('metadata-fake-server')
        self.addCleanup(server.stop)

        # NOTE(cbrandily): TempDir fixture creates a folder with 0o700
        # permissions but metadata_proxy_socket folder must be readable by all
        # users
        self.useFixture(
            helpers.RecursivePermDirFixture(
                os.path.dirname(self.agent.conf.metadata_proxy_socket), 0o555))
        server.start(MetadataFakeProxyHandler(status),
                     self.agent.conf.metadata_proxy_socket,
                     workers=0, backlog=4096, mode=self.SOCKET_MODE)
Esempio n. 9
0
 def run(self):
     server = agent_utils.UnixDomainWSGIServer(
                  constants.AGENT_PROCESS_METADATA)
     # Set the default metadata_workers if not yet set in the config file
     md_workers = self.conf.metadata_workers
     if md_workers is None:
         md_workers = host.cpu_count() // 2
     server.start(MetadataProxyHandler(self.conf),
                  self.conf.metadata_proxy_socket,
                  workers=md_workers,
                  backlog=self.conf.metadata_backlog,
                  mode=self._get_socket_mode())
     self._init_state_reporting()
     server.wait()
Esempio n. 10
0
    def setUp(self):
        super(TestMonitorDaemon, self).setUp()
        self.conf_dir = self.get_default_temp_dir().path
        self.pid_file = os.path.join(self.conf_dir, 'pid_file')
        self.log_file = os.path.join(self.conf_dir, 'log_file')
        self.state_file = os.path.join(self.conf_dir,
                                       'keepalived-state-change')
        self.cidr = '169.254.151.1/24'
        bridge = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
        self.machines = self.useFixture(mf.PeerMachines(bridge))
        self.router, self.peer = self.machines.machines[:2]
        self.router_id = uuidutils.generate_uuid()

        self.cmd_opts = [
            ha_router.STATE_CHANGE_PROC_NAME,
            '--router_id=%s' % self.router_id,
            '--namespace=%s' % self.router.namespace,
            '--conf_dir=%s' % self.conf_dir,
            '--log-file=%s' % self.log_file,
            '--monitor_interface=%s' % self.router.port.name,
            '--monitor_cidr=%s' % self.cidr,
            '--pid_file=%s' % self.pid_file,
            '--state_path=%s' % self.conf_dir,
            '--user=%s' % os.geteuid(),
            '--group=%s' % os.getegid()
        ]
        self.ext_process = external_process.ProcessManager(
            None,
            '%s.monitor' % self.pid_file,
            None,
            service='test_ip_mon',
            pids_path=self.conf_dir,
            default_cmd_callback=self._callback,
            run_as_root=True)

        server = linux_utils.UnixDomainWSGIServer(
            'neutron-keepalived-state-change', num_threads=1)
        server.start(ha.KeepalivedStateChangeHandler(mock.Mock()),
                     self.state_file,
                     workers=0,
                     backlog=ha.KEEPALIVED_STATE_CHANGE_SERVER_BACKLOG)
        self.addCleanup(server.stop)
Esempio n. 11
0
 def run(self):
     #begin: added by jimin3,bug-78254,2016-12-7. Deleted by jimin3,bug-82197,2017-1-3
     #self._init_state_reporting()
     #while self.duplicate_agent_times <= (cfg.CONF.AGENT.agent_down_time / cfg.CONF.AGENT.report_interval + 1):
     #    if self.agent_state.get('start_flag'):
     #        time.sleep(cfg.CONF.AGENT.report_interval)
     #    else:
     #        break
     #if self.duplicate_agent_times > (cfg.CONF.AGENT.agent_down_time / cfg.CONF.AGENT.report_interval + 1):
     #    raise agent_common_utils.DuplicatedAgent()
     #end: added by jimin3,bug-78254,2016-12-7. Deleted by jimin3,bug-82197,2017-1-3
     server = agent_utils.UnixDomainWSGIServer('neutron-metadata-agent')
     server.start(MetadataProxyHandler(self.conf),
                  self.conf.metadata_proxy_socket,
                  workers=self.conf.metadata_workers,
                  backlog=self.conf.metadata_backlog,
                  mode=self._get_socket_mode())
     #begin: deleted by jimin3,bug-78254,2016-12-7. Added by jimin3,bug-82197,2017-1-3
     self._init_state_reporting()
     #end: deleted by jimin3,bug-78254,2016-12-7. Added by jimin3,bug-82197,2017-1-3
     server.wait()
Esempio n. 12
0
 def setUp(self):
     super(TestUnixDomainWSGIServer, self).setUp()
     self.eventlet_p = mock.patch.object(utils, 'eventlet')
     self.eventlet = self.eventlet_p.start()
     self.server = utils.UnixDomainWSGIServer('test')
Esempio n. 13
0
 def start(self):
     server = agent_utils.UnixDomainWSGIServer('networking-cilium-agent')
     server.start()