Skip to content

Commit

Permalink
Merge branch 'master' into release/0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol committed May 21, 2020
2 parents 017fdc0 + bc93c56 commit 806930f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Ravada.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2565,6 +2565,20 @@ sub _do_execute_command {
if $request->status() ne 'done'
&& $request->status() !~ /^retry/i;
}
$self->_set_domain_changed($request) if $request->status eq 'done';
}

sub _set_domain_changed($self, $request) {
my $id_domain = $request->id_domain;
if (!defined $id_domain) {
$id_domain = $request->defined_arg('id_domain');
}
return if !defined $id_domain;

my $sth = $CONNECTOR->dbh->prepare("UPDATE domains set date_changed=CURRENT_TIMESTAMP"
." WHERE id=? ");
$sth->execute($id_domain);

}

sub _cmd_manage_pools($self, $request) {
Expand Down
10 changes: 10 additions & 0 deletions t/request/30_hardware.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ my %CREATE_ARGS = (
,Void => { id_owner => $USER->id }
);

my $TEST_TIMESTAMP = 0;

########################################################################
sub create_args {
my $backend = shift;
Expand Down Expand Up @@ -68,6 +70,9 @@ sub test_add_hardware_request_drivers {
sub test_add_hardware_request($vm, $domain, $hardware, $data={}) {

confess if !ref($data) || ref($data) ne 'HASH';

my $date_changed = $domain->_data('date_changed');

my @list_hardware1 = $domain->get_controller($hardware);
my $numero = scalar(@list_hardware1)+1;
while ($hardware eq 'usb' && $numero > 4) {
Expand All @@ -87,6 +92,7 @@ sub test_add_hardware_request($vm, $domain, $hardware, $data={}) {
is($@,'') or return;
$USER->unread_messages();
ok($req, 'Request');
sleep 1 if !$TEST_TIMESTAMP;
rvd_back->_process_all_requests_dont_fork();
is($req->status(),'done');
is($req->error(),'') or exit;
Expand Down Expand Up @@ -117,6 +123,9 @@ sub test_add_hardware_request($vm, $domain, $hardware, $data={}) {
} elsif($hardware eq 'disk') {
like($new_hardware->{file},qr(\.iso$)) or die Dumper($info->{hardware}->{$hardware});
}
if (!$TEST_TIMESTAMP++) {
isnt($domain->_data('date_changed'), $date_changed);
}
}

sub test_add_cdrom($domain) {
Expand Down Expand Up @@ -639,6 +648,7 @@ for my $vm_name ( qw(Void KVM )) {
ok(!$domain_b->is_active);

}
ok($TEST_TIMESTAMP);
}

end();
Expand Down

0 comments on commit 806930f

Please sign in to comment.