Skip to content

Commit

Permalink
virtio_serial: accept specified chardev_path and serial_name
Browse files Browse the repository at this point in the history
Some test need use specified chardev_path and serial_name for
testing, make it accept these definiation.
If it is not defined, use the default value that generated by
the test framework.

Signed-off-by: Yanan Fu <[email protected]>
  • Loading branch information
yanan-fu committed Feb 17, 2020
1 parent e2d5198 commit 80154bb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions virttest/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1756,8 +1756,14 @@ def sort_key(dev):
5000, 5899, len(serials), host)
reg_count = 0
for index, serial in enumerate(serials):
serial_filename = vm.get_serial_console_filename(serial)
serial_params = params.object_params(serial)
serial_filename = serial_params.get('chardev_path')
if serial_filename:
serial_dirname = os.path.dirname(serial_filename)
if not os.path.isdir(serial_dirname):
os.makedirs(serial_dirname)
else:
serial_filename = vm.get_serial_console_filename(serial)
# Workaround for console issue, details:
# http://lists.gnu.org/archive/html/qemu-ppc/2013-10/msg00129.html
if 'ppc' in params.get('vm_arch_name', arch.ARCH)\
Expand All @@ -1771,9 +1777,11 @@ def sort_key(dev):
serial_params['chardev_host'] = host
serial_params['chardev_port'] = free_ports[index]
prefix = serial_params.get('virtio_port_name_prefix')
serial_name = prefix + str(len(self.virtio_ports))\
if prefix else serial
serial_params['serial_name'] = serial_name
serial_name = serial_params.get('serial_name')
if not serial_name:
serial_name = prefix + str(len(self.virtio_ports))\
if prefix else serial
serial_params['serial_name'] = serial_name
serial_devices = devices.serials_define_by_params(
serial, serial_params, serial_filename)

Expand Down

0 comments on commit 80154bb

Please sign in to comment.