line |
stmt |
code |
1
|
|
# Copyright 2009-2013 Bernhard M. Wiedemann |
2
|
|
# Copyright 2012-2015 SUSE LLC |
3
|
|
# SPDX-License-Identifier: GPL-2.0-or-later |
4
|
|
|
5
|
|
|
6
|
|
use Mojo::Base 'consoles::localXvnc', -signatures; |
7
|
1
|
use autodie ':all'; |
|
1
|
|
|
1
|
|
8
|
1
|
require IPC::System::Simple; |
|
1
|
|
|
1
|
|
9
|
|
use File::Which; |
10
|
1
|
|
|
1
|
|
|
1
|
|
11
|
|
# start Xvnc |
12
|
0
|
$self->SUPER::activate; |
|
0
|
|
|
0
|
|
13
|
|
|
14
|
0
|
my $testapi_console = $self->{testapi_console}; |
15
|
|
|
16
|
0
|
my @command = $self->backend->ipmi_cmdline; |
17
|
|
push(@command, qw(sol activate)); |
18
|
0
|
my $serial = $self->{args}->{serial}; |
19
|
0
|
my $cstr = join(' ', @command); |
20
|
0
|
|
21
|
0
|
# Try to deactivate IPMI SOL before activate |
22
|
|
eval { $self->backend->ipmitool("sol deactivate"); }; |
23
|
|
my $ipmi_response = $@; |
24
|
0
|
if ($ipmi_response) { |
|
0
|
|
25
|
0
|
# IPMI response like SOL payload already de-activated is expected |
26
|
0
|
die "Unexpected IPMI response: $ipmi_response" unless |
27
|
|
($ipmi_response =~ /SOL payload already de-activated/); |
28
|
0
|
} |
29
|
|
|
30
|
|
$self->callxterm($cstr, "ipmitool:$testapi_console"); |
31
|
|
} |
32
|
0
|
|
33
|
|
# Deactivate sol connection if it is activated |
34
|
|
if ($self->{activated}) { |
35
|
3
|
$self->backend->ipmitool("sol deactivate"); |
|
3
|
|
|
3
|
|
36
|
|
$self->{activated} = 0; |
37
|
3
|
} |
38
|
0
|
return; |
39
|
0
|
} |
40
|
|
|
41
|
3
|
# Try to deactivate IPMI SOL during disable |
42
|
|
$self->reset; |
43
|
|
$self->SUPER::disable; |
44
|
2
|
} |
|
2
|
|
|
2
|
|
45
|
|
|
46
|
2
|
if ($self->{activated}) { |
47
|
2
|
$self->backend->do_mc_reset; |
48
|
|
$self->{activated} = 0; |
49
|
|
} |
50
|
0
|
return; |
|
0
|
|
|
0
|
|
51
|
0
|
} |
52
|
0
|
|
53
|
0
|
1; |