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

[#51] Start a domain for a remote_ip

parent 028fd338
......@@ -414,23 +414,34 @@ Request to start a domain.
=over
=item $name : the domain name
=item user => $user : a Ravada::Auth::SQL user
=item $user : a Ravada::Auth::SQL user
=item name => $name : the domain name
=item remote_ip => $remote_ip: a Ravada::Auth::SQL user
Returns an object: Ravada::Request.
my $req = $rvd_front->start_domain($name, $user);
my $req = $rvd_front->start_domain(
user => $user
,name => 'mydomain'
, remote_ip => '192.168.1.1');
=cut
sub start_domain {
my $self = shift;
my $name = shift;
my $user = shift;
confess "ERROR: Must call start_domain with user=>\$user, name => \$name, remote_ip => \$ip"
if scalar @_ % 2;
my %args = @_;
# TODO check for user argument
$args{uid} = $args{user}->id if $args{user};
delete $args{user};
return Ravada::Request->start_domain(name => $name, uid => $user->id);
return Ravada::Request->start_domain( %args );
}
=head2 list_bases_anonymous
......
......@@ -74,9 +74,12 @@ sub test_start {
my $vm = rvd_back->search_vm($vm_name);
my $remote_ip = '99.88.77.66';
my $req = Ravada::Request->start_domain(
name => "does not exists"
,uid => $USER->id
,remote_ip => $remote_ip
);
$RAVADA->process_requests();
......@@ -97,6 +100,7 @@ sub test_start {
ok(!$domain->is_active,"Domain $name should be inactive") or return;
my $req2 = Ravada::Request->start_domain(name => $name, uid => $USER->id
,remote_ip => $remote_ip
);
$RAVADA->process_requests();
......
......@@ -118,7 +118,9 @@ for my $vm_name ('Void','KVM','LXC') {
$domain->name eq $name,"[$vm_name] Expecting domain name $name, got "
.($domain->name or '<UNDEF>'));
$req = $RVD_FRONT->start_domain($name, $USER);
my $ip = '99.88.77.66';
$req = $RVD_FRONT->start_domain(name => $name, user => $USER, remote_ip => $ip);
$RVD_FRONT->wait_request($req,10);
ok($req->status('done'),"Request ".$req->status);
ok(!$req->error,"[$vm_name] Request start domain expecting no error, got '".$req->error
......
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