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

[#51] fixed resume from requests

parent 86f4c1a5
......@@ -830,7 +830,7 @@ sub _cmd_resume {
$domain->resume(
remote_ip => $request->args('remote_ip')
,uid => $user
,user => $user
);
$request->status('done');
......
......@@ -100,7 +100,7 @@ before 'start' => \&_start_preconditions;
before 'pause' => \&_allow_manage;
after 'pause' => \&_post_pause;
before 'resume' => \&_allow_manage_any;
before 'resume' => \&_allow_manage;
after 'resume' => \&_post_resume;
before 'shutdown' => \&_allow_manage_args;
......@@ -154,7 +154,7 @@ sub _allow_manage {
if scalar(@_) % 2 == 0;
my ($user) = @_;
return $self->allow_manage_args( user => $user);
return $self->_allow_manage_args( user => $user);
}
......@@ -176,7 +176,7 @@ sub _allow_prepare_base {
$self->_check_has_clones();
$self->is_base(0);
if ($self->is_active) {
if ($self->is_active && !$self->is_paused) {
$self->pause($user);
$self->{_was_active} = 1;
}
......
......@@ -197,13 +197,14 @@ sub test_prepare_base_active {
ok(!$@,$@);
ok($domain->is_active,"[$vm_name] Domain ".$domain->name." should be active") or return;
ok(!$domain->is_paused,"[$vm_name] Domain ".$domain->name." should not be paused") or exit;
ok(!$domain->is_paused,"[$vm_name] Domain ".$domain->name." should not be paused") or return;
eval { $domain->prepare_base($USER) };
ok(!$@,"[$vm_name] Prepare base, expecting error='', got '$@'");
eval{ $domain->prepare_base($USER) };
ok(!$@,"[$vm_name] Prepare base, expecting error='', got '$@'") or exit;
ok($domain->is_active,"[$vm_name] Domain ".$domain->name." should be active") or exit;
ok(!$domain->is_paused,"[$vm_name] Domain ".$domain->name." should not be paused") or return;
ok($domain->is_active,"[$vm_name] Domain ".$domain->name." should be active") or return;
ok(!$domain->is_paused,"[$vm_name] Domain ".$domain->name
." should not be paused after prepare base") or return;
}
sub touch_mtime {
......
......@@ -123,7 +123,8 @@ sub test_fw_domain_pause {
my $vm = rvd_back->search_vm($vm_name);
my $domain = $vm->search_domain($domain_name);
ok($domain,"Searching for domain $domain_name") or return;
$domain->start( user => $USER, remote_ip => $remote_ip);
$domain->start( user => $USER, remote_ip => $remote_ip)
if !$domain->is_active();
my $display = $domain->display($USER);
($local_port) = $display =~ m{\d+\.\d+\.\d+\.\d+\:(\d+)};
......@@ -241,8 +242,8 @@ for my $vm_name (qw( Void KVM )) {
flush_rules();
my $domain_name = test_create_domain($vm_name);
test_fw_domain_pause($vm_name, $domain_name);
test_fw_domain($vm_name, $domain_name);
test_fw_domain_pause($vm_name, $domain_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