def log_serial_output(): vm_log_writer = self._vm_log_writers.get(instance_uuid) if vm_log_writer and vm_log_writer.is_active(): LOG.debug("Instance %s log writer is already running.", instance_name) else: vm_log_writer = ioutils.IOThread( pipe_path, console_log_path, self._MAX_CONSOLE_LOG_FILE_SIZE) vm_log_writer.start() self._vm_log_writers[instance_uuid] = vm_log_writer
def log_vm_serial_output(self, instance_name, instance_uuid): # Uses a 'thread' that will run in background, reading # the console output from the according named pipe and # write it to a file. console_log_path = self._pathutils.get_vm_console_log_paths( instance_name)[0] pipe_path = r'\\.\pipe\%s' % instance_uuid vm_log_writer = ioutils.IOThread(pipe_path, console_log_path, self._MAX_CONSOLE_LOG_FILE_SIZE) self._vm_log_writers[instance_uuid] = vm_log_writer vm_log_writer.start()
def _setup_log_vm_output_mocks(self): m = fake.PathUtils.get_vm_console_log_paths(mox.IsA(str)) m.AndReturn(('fake_vm_log_path', 'fake_vm_log_path.1')) ioutils.IOThread('fake_pipe', 'fake_vm_log_path', units.Mi).start()
def setUp(self): self._iothread = ioutils.IOThread(self._FAKE_SRC, self._FAKE_DEST, self._FAKE_MAX_BYTES) super(IOThreadTestCase, self).setUp()