Commit c1a1c981 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

show domain display from front

parent 29c1de1e
...@@ -471,6 +471,18 @@ sub _execute { ...@@ -471,6 +471,18 @@ sub _execute {
} }
sub _cmd_domdisplay {
my $self = shift;
my $request = shift;
$request->status('working');
my $name = $request->args('name');
confess "Unknown name for request ".Dumper($request) if!$name;
my $domain = $self->search_domain($request->args->{name});
return $domain->display;
}
sub _cmd_create { sub _cmd_create {
my $self = shift; my $self = shift;
my $request = shift; my $request = shift;
...@@ -574,6 +586,7 @@ sub _req_method { ...@@ -574,6 +586,7 @@ sub _req_method {
,create => \&_cmd_create ,create => \&_cmd_create
,remove => \&_cmd_remove ,remove => \&_cmd_remove
,shutdown => \&_cmd_shutdown ,shutdown => \&_cmd_shutdown
,domdisplay => \&_cmd_domdisplay
,ping_backend => \&_cmd_ping_backend ,ping_backend => \&_cmd_ping_backend
,prepare_base => \&_cmd_prepare_base ,prepare_base => \&_cmd_prepare_base
,list_vm_types => \&_cmd_list_vm_types ,list_vm_types => \&_cmd_list_vm_types
......
...@@ -208,8 +208,18 @@ sub search_domain_by_id { ...@@ -208,8 +208,18 @@ sub search_domain_by_id {
return if !keys %$row; return if !keys %$row;
lock_hash(%$row); lock_hash(%$row);
return $row; return $row;
}
sub domdisplay {
my $self = shift;
my $name = shift;
my $req = Ravada::Request->domdisplay($name);
$self->wait_request($req, 2);
return $req->result();
} }
......
...@@ -242,6 +242,27 @@ sub ping_backend { ...@@ -242,6 +242,27 @@ sub ping_backend {
return $self->_new_request( command => 'ping_backend' ); return $self->_new_request( command => 'ping_backend' );
} }
=head2 domdisplay
Returns the domdisplay of a domain
Arguments:
* domain name
=cut
sub domdisplay {
my $proto = shift;
my $class=ref($proto) || $proto;
my $name = shift;
my $self = {};
bless ($self, $class);
return $self->_new_request( command => 'domdisplay',args => { name => $name });
}
sub _new_request { sub _new_request {
my $self = shift; my $self = shift;
my %args = @_; my %args = @_;
...@@ -252,6 +273,9 @@ sub _new_request { ...@@ -252,6 +273,9 @@ sub _new_request {
$args{domain_name} = $args{name}; $args{domain_name} = $args{name};
delete $args{name}; delete $args{name};
} }
if ( ref $args{args} ) {
$args{args} = encode_json($args{args});
}
_init_connector() if !$CONNECTOR || !$$CONNECTOR; _init_connector() if !$CONNECTOR || !$$CONNECTOR;
...@@ -400,8 +424,8 @@ sub args { ...@@ -400,8 +424,8 @@ sub args {
my $name = shift; my $name = shift;
return $self->{args} if !$name; return $self->{args} if !$name;
confess "Unknown argument $name" confess "Unknown argument $name ".Dumper($self->{args})
if !exists $self->{args}->{name}; if !exists $self->{args}->{$name};
return $self->{args}->{$name}; return $self->{args}->{$name};
} }
......
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