action #122935
Updated by pvorel over 1 year ago
virtio console for user (user-virtio-terminal) was added in https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/14967 (#88193) and then used in various HPC tests: https://openqa.suse.de/tests/10220175 (sle-15-SP5-Online-x86_64-Build64.1-hpc_BETA_mpich_mpi_supportserver@64bit).
But it lack some functionality, thus workarounds needs to be used:
* user cannot switch from root-virtio-terminal (select_serial_terminal() which calls select_console('root-virtio-terminal')) to user-virtio-terminal (select_user_serial_terminal() which calls select_serial_terminal(0) which calls select_console('user-virtio-terminal')).
Workaround: kill sshd from 'root-console':
~~~ text
type_string('pkill -u root');
select_serial_terminal(0);
~~~
Used on various places:
* https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/9f84f058d22425bae123734c06a28fa988d5ba06/tests/hpc/mpi_master.pm#L39-L40
* https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/9f84f058d22425bae123734c06a28fa988d5ba06/tests/hpc/mpi_master.pm#L62-L63
* https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/9f84f058d22425bae123734c06a28fa988d5ba06/lib/hpcbase.pm#L354-L355
Issue long time ago reported reported by Jozef Pupava.
* serial prompt change handling is not encapsulated in library
https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/9f84f058d22425bae123734c06a28fa988d5ba06/lib/sles4sap.pm#L218-L222
~~~ text
# We need to change the 'serial_term_prompt' value for 'wait_serial'
my $serial_term_prompt = "$sapadmin> ";
enter_cmd(qq/PS1="$serial_term_prompt"/);
wait_serial(qr/PS1="$serial_term_prompt"/) if testapi::is_serial_terminal;
$testapi::distri->{serial_term_prompt} = "$serial_term_prompt";
~~~
https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/9f84f058d22425bae123734c06a28fa988d5ba06/lib/sles4sap.pm#L238-L239
~~~ text
# Reset 'serial_term_prompt' value for 'wait_serial'
$testapi::distri->{serial_term_prompt} = '# ';
~~~
* output log for extra root console (activated by VIRTIO_CONSOLE_NUM=2) saved output in "Logs & Assets" to virtio_console1.log. It was renamed to serial_terminal_user.txt (unify with serial_terminal.txt), also any *.log file which is saved will be renamed to *.txt
### CODE
I prepared PR in all 3 git repositories:
* https://github.com/os-autoinst/openQA/pull/4973
* https://github.com/os-autoinst/os-autoinst/pull/2240
* https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/16190
Although I prepared code for live console also show the output of virtio_console_user.log, it does not work.
### Testing
What needs special attention:
* HPC tests
reason: use user-virtio-terminal, require tap worker (I don't have), maintainer: Ioannis Bonatakis
e.g. sle-15-SP5-Online-x86_64-Build64.1-hpc_BETA_mpich_mpi_supportserver@64bit
https://openqa.suse.de/tests/10220175
* wicked tests
reason: use VIRTIO_CONSOLE_NUM=2 - the output was renamed from virtio_console1.log to serial_terminal_user.txt, require tap worker (I don't have), maintainer: asmorodskyi@suse.de, cfamullaconrad@suse.de, jalausuch@suse.com
e.g. wicked_ipv6_sut@64bit https://openqa.suse.de/tests/10219403
wicked_ipv6_ref@64bit https://openqa.suse.de/tests/10219400
which run also on o3: https://openqa.opensuse.org/tests/3029126 https://openqa.opensuse.org/tests/3029329
* mru-install-minimal-with-addons
reason: system_prepare.pm uses prepare_serial_console(), which adds one serial console for user-virtio-terminal (this should work quite well), this also check installer
* Sanity check for any LTP test (uses serial terminal)
* Tested on image created by mru-install-minimal-with-addons with virtio tests:
`TEST=virtio VIRTIO_CONSOLE=1 VIRTIO_CONSOLE_TEST=1 INSTALL_LTP= LTP_COMMAND_FILE= YAML_SCHEDULE= LTP_EXTRA_CONF_FLAGS= INCIDENT_ID= INCIDENT_REPO= PUBLISH_HDD_1= PUBLISH_PFLASH_VARS=`
http://quasar.suse.cz/tests/1742#downloads
* The same problem might be for svirt, which is used for root-serial-ssh and user-serial-ssh (on both: s390x zkvm == qemu, which is on osd) and s390x z/VM, which is on o3), but that will be another effort, now it just needs to be tested if svirt works unaffected now.
### Deployment
It works altogether, but not sure how to deploy it. Maybe https://github.com/os-autoinst/openQA/pull/4973 can be merged separately and deployed. Need to verify if https://github.com/os-autoinst/os-autoinst/pull/2240 can be deployed without https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/16190.