Commit 6ad7bf4e authored by Francesc Guasch's avatar Francesc Guasch
Browse files

get domain display from frontend

parent 8a336af5
...@@ -435,7 +435,7 @@ sub process_requests { ...@@ -435,7 +435,7 @@ sub process_requests {
my $req = Ravada::Request->open($id); my $req = Ravada::Request->open($id);
warn "executing request ".$req." ".Dumper($req) if $DEBUG || $debug; warn "executing request ".$req." ".Dumper($req) if $DEBUG || $debug;
$self->_execute($req); $self->_execute($req);
warn $req->status() if $DEBUG; warn "status: ".$req->status() if $DEBUG || $debug;
} }
$sth->finish; $sth->finish;
} }
...@@ -480,7 +480,12 @@ sub _cmd_domdisplay { ...@@ -480,7 +480,12 @@ sub _cmd_domdisplay {
my $name = $request->args('name'); my $name = $request->args('name');
confess "Unknown name for request ".Dumper($request) if!$name; confess "Unknown name for request ".Dumper($request) if!$name;
my $domain = $self->search_domain($request->args->{name}); my $domain = $self->search_domain($request->args->{name});
return $domain->display;
my $display = $domain->display;
$request->result({display => $display});
$request->status('done');
} }
sub _cmd_create { sub _cmd_create {
......
...@@ -217,10 +217,19 @@ sub domdisplay { ...@@ -217,10 +217,19 @@ sub domdisplay {
my $name = shift; my $name = shift;
my $req = Ravada::Request->domdisplay($name); my $req = Ravada::Request->domdisplay($name);
$self->wait_request($req, 2); $self->wait_request($req, 10);
return $req->result(); return if $req->status() ne 'done';
my $result = $req->result();
return $result->{display};
} }
sub start_domain {
my $self = shift;
my $name = shift;
return Ravada::Request->start_domain($name);
}
1; 1;
...@@ -127,5 +127,13 @@ for my $vm_name ('kvm','lxc') { ...@@ -127,5 +127,13 @@ for my $vm_name ('kvm','lxc') {
ok($domain && $domain->{name} && ok($domain && $domain->{name} &&
$domain->{name} eq $name,"Expecting domain name $name, got " $domain->{name} eq $name,"Expecting domain name $name, got "
.($domain->{name} or '<UNDEF>')); .($domain->{name} or '<UNDEF>'));
$RVD_FRONT->start_domain($name);
$RVD_FRONT->wait_request($req,10);
ok($req->status('done'),"Request ".$req->status);
my $display = $RVD_FRONT->domdisplay($name);
ok($display,"No display for domain $name found. Is it active ?");
ok($display =~ m{\w+://.*?:\d+},"Expecting display a URL, it is '$display'");
} }
done_testing(); done_testing();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment