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
22da3045
Unverified
Commit
22da3045
authored
Apr 08, 2019
by
Francesc Guasch
Committed by
GitHub
Apr 08, 2019
Browse files
refactor(requests): run request after_request (#1046)
issue #1045
parent
ac249d5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
22da3045
...
...
@@ -1156,6 +1156,7 @@ sub _upgrade_tables {
$self
->
_upgrade_table
('
requests
','
at_time
','
int(11) DEFAULT NULL
');
$self
->
_upgrade_table
('
requests
','
pid
','
int(11) DEFAULT NULL
');
$self
->
_upgrade_table
('
requests
','
start_time
','
int(11) DEFAULT NULL
');
$self
->
_upgrade_table
('
requests
','
after_request
','
int(11) DEFAULT NULL
');
$self
->
_upgrade_table
('
requests
','
at_time
','
int(11) DEFAULT NULL
');
$self
->
_upgrade_table
('
requests
','
run_time
','
float DEFAULT NULL
');
...
...
lib/Ravada/Request.pm
View file @
22da3045
...
...
@@ -271,7 +271,7 @@ sub remove_domain {
my
$self
=
{};
bless
(
$self
,
$class
);
return
$self
->
_new_request
(
command
=>
'
remove
'
,
args
=>
encode_json
(
\
%args
)
)
;
return
$self
->
_new_request
(
command
=>
'
remove
'
,
args
=>
\
%args
);
}
...
...
@@ -330,7 +330,7 @@ sub start_clones {
my
$self
=
{};
bless
(
$self
,
$class
);
return
$self
->
_new_request
(
command
=>
'
start_clones
'
,
args
=>
encode_json
(
$args
)
)
;
return
$self
->
_new_request
(
command
=>
'
start_clones
'
,
args
=>
$args
);
}
=head2 pause_domain
...
...
@@ -350,7 +350,7 @@ sub pause_domain {
my
$self
=
{};
bless
(
$self
,
$class
);
return
$self
->
_new_request
(
command
=>
'
pause
'
,
args
=>
encode_json
(
$args
)
)
;
return
$self
->
_new_request
(
command
=>
'
pause
'
,
args
=>
$args
);
}
=head2 resume_domain
...
...
@@ -370,7 +370,7 @@ sub resume_domain {
my
$self
=
{};
bless
(
$self
,
$class
);
return
$self
->
_new_request
(
command
=>
'
resume
'
,
args
=>
encode_json
(
$args
)
)
;
return
$self
->
_new_request
(
command
=>
'
resume
'
,
args
=>
$args
);
}
...
...
@@ -466,7 +466,7 @@ sub prepare_base {
return
$self
->
_new_request
(
command
=>
'
prepare_base
'
,
id_domain
=>
$args
{
id_domain
}
,
args
=>
encode_json
(
$args
)
);
,
args
=>
$args
);
}
...
...
@@ -496,7 +496,7 @@ sub remove_base {
my
$req
=
$self
->
_new_request
(
command
=>
'
remove_base
'
,
id_domain
=>
$args
->
{
id_domain
}
,
args
=>
encode_json
(
$args
)
);
,
args
=>
$args
);
return
$req
;
}
...
...
@@ -561,6 +561,9 @@ sub _new_request {
confess
"
ERROR: Different id_domain:
"
.
Dumper
(
\
%args
)
if
$args
{
id_domain
}
&&
$args
{
id_domain
}
ne
$id_domain_args
;
$args
{
id_domain
}
=
$id_domain_args
;
$args
{
after_request
}
=
delete
$args
{
args
}
->
{
after_request
}
if
exists
$args
{
args
}
->
{
after_request
};
}
$args
{
args
}
=
encode_json
(
$args
{
args
});
}
...
...
@@ -892,7 +895,7 @@ sub rename_domain {
return
$self
->
_new_request
(
command
=>
'
rename_domain
'
,
id_domain
=>
$args
->
{
id_domain
}
,
args
=>
encode_json
(
$args
)
,
args
=>
$args
);
}
...
...
@@ -921,7 +924,7 @@ sub set_driver {
return
$self
->
_new_request
(
command
=>
'
set_driver
'
,
id_domain
=>
$args
->
{
id_domain
}
,
args
=>
encode_json
(
$args
)
,
args
=>
$args
);
}
...
...
@@ -949,7 +952,7 @@ sub add_hardware {
return
$self
->
_new_request
(
command
=>
'
add_hardware
'
,
id_domain
=>
$args
->
{
id_domain
}
,
args
=>
encode_json
(
$args
)
,
args
=>
$args
);
}
...
...
@@ -977,7 +980,7 @@ sub remove_hardware {
return
$self
->
_new_request
(
command
=>
'
remove_hardware
'
,
id_domain
=>
$args
->
{
id_domain
}
,
args
=>
encode_json
(
$args
)
,
args
=>
$args
);
}
...
...
@@ -1008,7 +1011,7 @@ sub hybernate {
return
$self
->
_new_request
(
command
=>
'
hybernate
'
,
id_domain
=>
$args
->
{
id_domain
}
,
args
=>
encode_json
(
$args
)
,
args
=>
$args
);
}
...
...
@@ -1031,7 +1034,7 @@ sub download {
return
$self
->
_new_request
(
command
=>
'
download
'
,
args
=>
encode_json
(
$args
)
,
args
=>
$args
);
}
...
...
@@ -1182,7 +1185,7 @@ sub remove_base_vm {
return
$self
->
_new_request
(
command
=>
'
remove_base_vm
'
,
args
=>
encode_json
(
$args
)
,
args
=>
$args
);
}
...
...
@@ -1574,6 +1577,13 @@ sub AUTOLOAD {
my
$name
=
$AUTOLOAD
;
$name
=~
s/.*://
;
if
(
!
ref
(
$self
)
&&
$VALID_ARG
{
$name
}
)
{
return
_new_request
(
$self
,
command
=>
$name
,
args
=>
_check_args
(
$name
,
@
_
)
);
}
confess
"
Can't locate object method
$name
via package
$self
"
if
!
ref
(
$self
);
...
...
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