Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
c3c4002a
Commit
c3c4002a
authored
Feb 20, 2017
by
Francesc Guasch
Browse files
[#122] Set killed requests done
parent
dbc84569
Changes
2
Hide whitespace changes
Inline
Side-by-side
bin/rvd_back.pl
View file @
c3c4002a
...
...
@@ -60,7 +60,6 @@ $Ravada::CAN_FORK=0 if $NOFORK;
our
(
$FH_DOWNLOAD
,
$DOWNLOAD_TOTAL
);
my
$RAVADA
=
Ravada
->
new
(
config
=>
$FILE_CONFIG
);
my
$REMOTE_VIEWER
;
###################################################################
#
...
...
@@ -71,8 +70,11 @@ sub do_start {
my
$old_error
=
(
$@
or
'');
my
$cnt_error
=
0
;
my
$ravada
=
Ravada
->
new
(
config
=>
$FILE_CONFIG
);
$ravada
->
clean_killed_requests
();
for
(;;)
{
eval
{
$
RAVADA
->
process_requests
()
};
eval
{
$
ravada
->
process_requests
()
};
warn
"
$@
\n
"
if
$@
&&
(
!
$old_error
||
$old_error
ne
$@
);
$old_error
=
(
$@
or
'');
if
(
$@
&&
$cnt_error
++
>
60
)
{
...
...
@@ -145,7 +147,8 @@ sub import_domain {
print
"
User name :
";
my
$user
=
<
STDIN
>
;
chomp
$user
;
$RAVADA
->
import_domain
(
name
=>
$name
,
vm
=>
'
KVM
',
user
=>
$user
);
my
$ravada
=
Ravada
->
new
(
config
=>
$FILE_CONFIG
);
$ravada
->
import_domain
(
name
=>
$name
,
vm
=>
'
KVM
',
user
=>
$user
);
}
#################################################################
...
...
lib/Ravada.pm
View file @
c3c4002a
...
...
@@ -555,6 +555,25 @@ sub remove_volume {
}
=head2 clean_killed_requests
Before processing requests, old killed requests must be cleaned.
=cut
sub
clean_killed_requests
{
my
$self
=
shift
;
my
$sth
=
$CONNECTOR
->
dbh
->
prepare
("
SELECT id FROM requests
"
.
"
WHERE status='working'
"
);
$sth
->
execute
;
while
(
my
(
$id
)
=
$sth
->
fetchrow
)
{
my
$req
=
Ravada::
Request
->
open
(
$id
);
$req
->
status
("
done
","
Killed before completion
");
}
}
=head2 process_requests
This is run in the ravada backend. It processes the commands requested by the fronted
...
...
@@ -578,7 +597,8 @@ sub process_requests {
$sth
->
execute
;
while
(
my
(
$id_request
,
$id_domain
)
=
$sth
->
fetchrow
)
{
my
$req
=
Ravada::
Request
->
open
(
$id_request
);
next
if
$self
->
_domain_working
(
$id_domain
,
$id_request
);
next
if
$req
->
command
!~
/shutdown/i
&&
$self
->
_domain_working
(
$id_domain
,
$id_request
);
$self
->
_wait_pids_nohang
();
warn
"
executing request
"
.
$req
->
id
.
"
"
.
$req
->
status
()
.
"
"
.
$req
->
command
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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