Commit 4c47b069 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

Merge branch 'master' into release/0.10.0

parents 24dcb343 4764b89e
......@@ -1569,6 +1569,7 @@ sub _upgrade_tables {
}
$self->_upgrade_table('domains','shared_storage','varchar(254)');
$self->_upgrade_table('domains','post_shutdown','int not null default 0');
$self->_upgrade_table('domains','post_hibernated','int not null default 0');
$self->_upgrade_table('domains_network','allowed','int not null default 1');
......@@ -3909,7 +3910,7 @@ sub _refresh_active_domains($self, $request=undef) {
$request->error("checking $domain_data->{name}") if $request;
next if $active_domain{$domain_data->{id}};
my $domain = Ravada::Domain->open($domain_data->{id});
next if !$domain || $domain->is_hibernated;
next if !$domain;
$self->_refresh_active_domain($domain, \%active_domain);
$self->_remove_unnecessary_downs($domain) if !$domain->is_active;
}
......@@ -3954,7 +3955,8 @@ sub _refresh_disabled_nodes($self, $request = undef ) {
sub _refresh_active_domain($self, $domain, $active_domain) {
$domain->check_status();
return if $domain->is_hibernated();
return $self->_refresh_hibernated($domain) if $domain->is_hibernated();
my $is_active = $domain->is_active();
......@@ -3970,6 +3972,12 @@ sub _refresh_active_domain($self, $domain, $active_domain) {
if $domain->_data('status') eq 'shutdown' && !$domain->_data('post_shutdown');
}
sub _refresh_hibernated($self, $domain) {
return unless $domain->is_hibernated();
$domain->_post_hibernated() if !$domain->_data('post_hibernated');
}
sub _refresh_down_domains($self, $active_domain, $active_vm) {
my $sth = $CONNECTOR->dbh->prepare(
"SELECT id, name, id_vm FROM domains WHERE status='active'"
......
......@@ -241,6 +241,10 @@ sub _check_clean_shutdown($self) {
|| $self->_active_iptables(id_domain => $self->id)) {
$self->_post_shutdown();
}
if ($self->_data('status') eq 'hibernated' && !$self->_data('post_hibernated')) {
$self->_post_hibernated();
}
}
sub _set_last_vm($self,$force=0) {
......@@ -300,6 +304,7 @@ sub _vm_disconnect {
sub _around_start($orig, $self, @arg) {
$self->_data( 'post_shutdown' => 0);
$self->_data( 'post_hibernated' => 0);
$self->_start_preconditions(@arg);
my %arg;
......@@ -2412,6 +2417,7 @@ sub _post_pause {
sub _post_hibernate($self, $user) {
$self->_data(status => 'hibernated');
$self->_data(post_hibernated => 1);
$self->_remove_iptables();
$self->_close_exposed_port();
}
......
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