Commit 701fddfd authored by Francesc Guasch's avatar Francesc Guasch
Browse files

refactor(backend): remove messages and don't fail with dead nodes

parent 877ee13e
......@@ -133,7 +133,7 @@ our %COMMAND = (
,important=> {
limit => 20
,priority => 1
,commands => ['clone','start','start_clones','create','open_iptables']
,commands => ['clone','start','start_clones','create','open_iptables','list_network_interfaces']
}
,secondary => {
limit => 50
......@@ -638,6 +638,25 @@ sub _remove_unnecessary_messages {
}
sub _remove_messages {
my $self = shift;
my $uid;
$uid = $self->defined_arg('id_owner');
$uid = $self->defined_arg('uid') if !$uid;
return if !$uid;
my $sth = $$CONNECTOR->dbh->prepare(
"DELETE FROM messages WHERE id_user=? AND id_request=? "
);
$sth->execute($uid, $self->id);
$sth->finish;
}
=head2 result
......
......@@ -642,8 +642,12 @@ sub _check_require_base {
if keys %args;
my $base = Ravada::Domain->open($id_base);
my %ignore_requests = map { $_ => 1 } qw(clone refresh_machine set_base_vm);
if (my @requests = grep { !$ignore_requests{$_->command} } $base->list_requests) {
my %ignore_requests = map { $_ => 1 } qw(clone refresh_machine set_base_vm start_clones);
my @requests;
for my $req ( $base->list_requests ) {
push @requests,($req) if !$ignore_requests{$req->command};
}
if (@requests) {
confess "ERROR: Domain ".$base->name." has ".$base->list_requests
." requests.\n"
.Dumper([$base->list_requests])
......@@ -1313,6 +1317,7 @@ sub shutdown_domains($self) {
}
sub shared_storage($self, $node, $dir) {
return if !$node->is_active || !$self->is_active;
my $cached_st_key = "_cached_shared_storage_".$self->name.$node->name.$dir;
$cached_st_key =~ s{/}{_}g;
return $self->{$cached_st_key} if exists $self->{$cached_st_key};
......
......@@ -671,7 +671,7 @@ sub test_clone_make_base {
$clone->prepare_base(user_admin);
is($clone->base_in_vm($vm->id),1);
is($clone->base_in_vm($node->id),undef);
is($clone->base_in_vm($node->id),0);
$clone->remove(user_admin);
$domain->remove(user_admin);
......
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