def _setup_serial_proxy_handler(self): self._listen_host = ( CONF.serial_console.proxyclient_address) self._listen_port = serial_console.acquire_port( self._listen_host) LOG.info(_LI('Initializing serial proxy on ' '%(addr)s:%(port)s, handling connections ' 'to instance %(instance_name)s.'), {'addr': self._listen_host, 'port': self._listen_port, 'instance_name': self._instance_name}) # Use this event in order to manage # pending queue operations. self._client_connected = threading.Event() self._input_queue = ioutils.IOQueue( client_connected=self._client_connected) self._output_queue = ioutils.IOQueue( client_connected=self._client_connected) self._serial_proxy = serialproxy.SerialProxy( self._instance_name, self._listen_host, self._listen_port, self._input_queue, self._output_queue, self._client_connected) self._workers.append(self._serial_proxy)
def setUp(self): super(IOQueueTestCase, self).setUp() self._mock_queue = mock.Mock() queue_patcher = mock.patch.object(ioutils.Queue, 'Queue', new=self._mock_queue) queue_patcher.start() self.addCleanup(queue_patcher.stop) self._mock_client_connected = mock.Mock() self._ioqueue = ioutils.IOQueue(self._mock_client_connected)