line |
stmt |
code |
1
|
|
# Copyright 2016-2020 SUSE LLC |
2
|
|
# SPDX-License-Identifier: GPL-2.0-or-later |
3
|
|
|
4
|
|
# this is just a stupid console to track if we're connected to the host |
5
|
|
# it is used in s390x backend for serial connection |
6
|
|
|
7
|
|
|
8
|
|
use Mojo::Base 'consoles::network_console', -signatures; |
9
|
21
|
use autodie ':all'; |
|
21
|
|
|
21
|
|
10
|
21
|
|
|
21
|
|
|
21
|
|
11
|
|
my $hostname = $args->{hostname}; |
12
|
0
|
my $zvmguest = $bmwqemu::vars{ZVM_GUEST}; |
|
0
|
|
|
0
|
|
|
0
|
|
13
|
0
|
|
14
|
0
|
# ssh connection to SUT for agetty |
15
|
|
my $ttyconn = $self->backend->new_ssh_connection(hostname => $hostname, password => $args->{password}, username => 'root'); |
16
|
|
|
17
|
0
|
# start agetty to ensure that iucvconn is not killed |
18
|
|
my $chan = $ttyconn->channel() || $ttyconn->die_with_error(); |
19
|
|
$chan->blocking(0); |
20
|
0
|
$chan->pty(1); |
21
|
0
|
if (!$chan->exec('smart_agetty hvc0')) { |
22
|
0
|
bmwqemu::fctwarn('Unable to execute "smart_agetty hvc0" at this point: ' . ($ttyconn->error // 'unknown SSH error')); |
23
|
0
|
} |
24
|
0
|
|
25
|
|
# Save objects to prevent unexpected closings |
26
|
|
$self->{ttychan} = $chan; |
27
|
|
$self->{ttyconn} = $ttyconn; |
28
|
0
|
|
29
|
0
|
# ssh connection to SUT for iucvconn |
30
|
|
my ($ssh, $serialchan) = $self->backend->start_ssh_serial(hostname => $args->{hostname}, password => $args->{password}, username => 'root'); |
31
|
|
# start iucvconn |
32
|
0
|
bmwqemu::diag('ssh iucvconn: grabbing serial console'); |
33
|
|
$ssh->blocking(1); |
34
|
0
|
if (!$serialchan->exec("iucvconn $zvmguest lnxhvc0")) { |
35
|
0
|
bmwqemu::fctwarn('ssh iucvconn: unable to grab serial console at this point: ' . ($ssh->error // 'unknown SSH error')); |
36
|
0
|
} |
37
|
0
|
$ssh->blocking(0); |
38
|
|
} |
39
|
0
|
|
40
|
|
# to be called on reconnect |
41
|
|
$self->backend->stop_ssh_serial; |
42
|
|
} |
43
|
0
|
|
|
0
|
|
|
0
|
|
44
|
0
|
|
45
|
|
1; |