Skip to content

Commit

Permalink
Little simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Feb 6, 2018
1 parent 0ebf8ea commit 7bbdf83
Showing 1 changed file with 3 additions and 35 deletions.
38 changes: 3 additions & 35 deletions backend/spvm.pm
Expand Up @@ -40,12 +40,12 @@ sub do_start_vm {
open(my $sf, '>', $self->{serialfile});
close($sf);

my $sol = $testapi::distri->add_console('novalink-ssh', 'ssh-xterm', {
my $ssh = $testapi::distri->add_console('novalink-ssh', 'ssh-xterm', {
hostname => get_required_var('NOVALINK_HOSTNAME'),
password => get_required_var('NOVALINK_PASSWORD'),
username => get_var('NOVALINK_USERNAME', 'root')
});
$sol->backend($self);
$ssh->backend($self);

# remove backend.crashed
$self->unlink_crash_file;
Expand All @@ -56,30 +56,10 @@ sub do_stop_vm {
my ($self) = @_;

$self->stop_serial_grab;
$self->deactivate_console({testapi_console => 'novalink-ssh'});
return {};
}

# In list context returns pair ($stdout, $stderr). In void (and scalar)
# context just logs stdout and stderr, returns nothing.
sub get_ssh_output {
my ($chan) = @_;

my ($stdout, $errout) = ('', '');
while (!$chan->eof) {
if (my ($o, $e) = $chan->read2) {
$stdout .= $o;
$errout .= $e;
}
}
if (wantarray) {
return ($stdout, $errout);
}
else {
bmwqemu::diag "Command's stdout:\n$stdout" if length($stdout);
bmwqemu::diag "Command's stderr:\n$errout" if length($errout);
}
}

sub run_cmd {
my ($self, $cmd, $hostname, $password) = @_;
$hostname ||= get_required_var('NOVALINK_HOSTNAME');
Expand Down Expand Up @@ -111,18 +91,6 @@ sub is_shutdown {
return 0;
}

# Open another ssh connection to grab the serial console.
sub start_serial_grab {
my ($self, $name) = @_;

my $chan = $self->start_ssh_serial(hostname => get_required_var('NOVALINK_HOSTNAME'),
password => get_required_var('NOVALINK_PASSWORD'),
username => get_var('NOVALINK_USER', 'root'));

#$chan->exec('');

}

sub check_socket {
my ($self, $fh, $write) = @_;

Expand Down

0 comments on commit 7bbdf83

Please sign in to comment.