Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
b17b846a
Unverified
Commit
b17b846a
authored
May 04, 2021
by
Francesc Guasch
Committed by
GitHub
May 04, 2021
Browse files
wip: use stored shutdown_timeout (#1540)
parent
f0554a0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
b17b846a
...
...
@@ -1924,6 +1924,7 @@ sub _upgrade_tables {
$self
->
_upgrade_table
('
domains
','
needs_restart
','
int not null default 0
');
$self
->
_upgrade_table
('
domains
','
shutdown_disconnected
','
int not null default 0
');
$self
->
_upgrade_table
('
domains
','
shutdown_timeout
','
int default null
');
$self
->
_upgrade_table
('
domains
','
date_changed
','
timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
');
if
(
$self
->
_upgrade_table
('
domains
','
screenshot
','
MEDIUMBLOB
'))
{
...
...
@@ -3863,7 +3864,7 @@ sub _cmd_shutdown {
my
$uid
=
$request
->
args
('
uid
');
my
$name
=
$request
->
defined_arg
('
name
');
my
$id_domain
=
$request
->
defined_arg
('
id_domain
');
my
$timeout
=
(
$request
->
arg
s
('
timeout
')
or
60
)
;
my
$timeout
=
$request
->
defined_
arg
('
timeout
');
my
$id_vm
=
$request
->
defined_arg
('
id_vm
');
confess
"
ERROR: Missing id_domain or name
"
if
!
$id_domain
&&
!
$name
;
...
...
lib/Ravada/Domain.pm
View file @
b17b846a
...
...
@@ -28,8 +28,8 @@ use Ravada::Booking;
use
Ravada::Domain::
Driver
;
use
Ravada::
Utils
;
our
$TIMEOUT_SHUTDOWN
=
20
;
our
$TIMEOUT_REBOOT
=
20
;
our
$TIMEOUT_SHUTDOWN
=
1
20
;
our
$TIMEOUT_REBOOT
=
1
20
;
our
$CONNECTOR
;
our
$MIN_FREE_MEMORY
=
1024
*
1024
;
...
...
@@ -2728,6 +2728,9 @@ sub _post_shutdown {
my
%arg
=
@_
;
my
$timeout
=
delete
$arg
{
timeout
};
if
(
!
defined
$timeout
)
{
$timeout
=
(
$self
->
_data
('
shutdown_timeout
')
or
$TIMEOUT_SHUTDOWN
);
}
if
(
$self
->
_vm
->
is_active
)
{
$self
->
_remove_iptables
();
...
...
@@ -2755,7 +2758,7 @@ sub _post_shutdown {
}
}
if
(
defined
$timeout
&&
!
$self
->
is_removed
&&
$is_active
)
{
if
(
defined
$timeout
&&
$timeout
&&
!
$self
->
is_removed
&&
$is_active
)
{
if
(
$timeout
<
2
)
{
sleep
$timeout
;
$is_active
=
$self
->
is_active
;
...
...
lib/Ravada/Request.pm
View file @
b17b846a
...
...
@@ -537,8 +537,6 @@ sub shutdown_domain {
my
$args
=
_check_args
('
shutdown_domain
',
@
_
);
$args
->
{
timeout
}
=
$TIMEOUT_SHUTDOWN
if
!
exists
$args
->
{
timeout
};
confess
"
ERROR: You must supply either id_domain or name
"
.
Dumper
(
$args
)
if
!
$args
->
{
id_domain
}
&&
!
$args
->
{
name
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment