Commit f04a9ad7 authored by Francesc Guasch's avatar Francesc Guasch Committed by Fernando Verdugo
Browse files

volatile test #629 (#798)

* feat(frontend): redirect to logout after timeout

issue #753

* fix(KVM): create domain with iso_file failed

* test(volatile): volatile clones should be active on creation

* fix(volatile): deal with volatile clones disappear on shutdown

issue #629

* test: removed debug
parent f8fe2727
......@@ -1413,10 +1413,13 @@ sub _around_is_active($orig, $self) {
my $status = 'shutdown';
$status = 'active' if $is_active;
$status = 'hibernated' if !$is_active && $self->is_hibernated;
$status = 'hibernated' if !$is_active && !$self->is_removed && $self->is_hibernated;
$self->_data(status => $status);
eval {
$self->display(Ravada::Utils::user_daemon()) if $is_active;
};
warn "around_is_active display $@" if $@;
return $is_active;
}
......
......@@ -541,7 +541,10 @@ Returns whether the domain is running or not
sub is_active {
my $self = shift;
return 0 if $self->is_removed;
return ( $self->domain->is_active or 0);
my $is_active = 0;
eval { $is_active = $self->domain->is_active };
die $@ if $@ && $@ !~ /code: 42,/;
return $is_active;
}
=head2 is_persistent
......@@ -1730,11 +1733,17 @@ sub pre_remove {
sub is_removed($self) {
my $is_removed = 0;
return 1 if !$self->domain;
eval { $self->domain->get_xml_description};
return 1 if $@ && $@ =~ /libvirt error code: 42/;
eval {
$is_removed = 1 if !$self->domain;
$self->domain->get_xml_description if !$is_removed;
};
if( $@ && $@ =~ /libvirt error code: 42,/ ) {
$@ = '';
$is_removed = 1;
}
die $@ if $@;
return 0;
return $is_removed;
}
sub internal_id($self) {
......
......@@ -165,7 +165,10 @@ sub _around_create_domain {
my $user = Ravada::Auth::SQL->search_by_id($id_owner);
$domain->is_volatile(1) if $user->is_temporary() ||($base && $base->volatile_clones());
$domain->_post_start($owner) if $domain->is_active;
eval {
$domain->start($owner) if $domain->is_volatile && ! $domain->is_active;
};
die $@ if $@ && $@ !~ /code: 55,/;
$domain->get_info();
......
......@@ -97,6 +97,7 @@ sub test_volatile {
my @volumes = $clone->list_volumes();
is($clone->is_active, 1);
eval { $clone->shutdown_now(user_admin) if $clone->is_active};
is(''.$@,'',"[$vm_name] Expecting no error after shutdown");
......
Markdown is supported
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