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
4fab64a3
Commit
4fab64a3
authored
Feb 03, 2020
by
Francesc Guasch
Browse files
wip(backend): complete spinoff
issue #852
parent
2dd9e9ba
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
4fab64a3
...
...
@@ -3566,9 +3566,12 @@ sub _req_method {
,
add_disk
=>
\
&_cmd_add_disk
,
copy_screenshot
=>
\
&_cmd_copy_screenshot
,
cmd_cleanup
=>
\
&_cmd_cleanup
,
remove_base
=>
\
&_cmd_remove_base
,
spinoff
=>
\
&_cmd_spinoff
,
set_base_vm
=>
\
&_cmd_set_base_vm
,
remove_base_vm
=>
\
&_cmd_set_base_vm
,
refresh_vms
=>
\
&_cmd_refresh_vms
,
ping_backend
=>
\
&_cmd_ping_backend
,
prepare_base
=>
\
&_cmd_prepare_base
...
...
lib/Ravada/Domain.pm
View file @
4fab64a3
...
...
@@ -175,6 +175,7 @@ around 'force_shutdown' => \&_around_shutdown_now;
before
'
remove_base
'
=>
\
&_pre_remove_base
;
after
'
remove_base
'
=>
\
&_post_remove_base
;
after
'
spinoff
'
=>
\
&_post_spinoff
;
before
'
rename
'
=>
\
&_pre_rename
;
after
'
rename
'
=>
\
&_post_rename
;
...
...
@@ -1935,6 +1936,11 @@ sub _remove_all_bases($self) {
}
}
sub
_post_spinoff
($self) {
my
$sth
=
$$CONNECTOR
->
dbh
->
prepare
("
UPDATE domains set id_base=NULL WHERE id=?
");
$sth
->
execute
(
$self
->
id
);
}
sub
_pre_shutdown_domain
{}
sub
_post_remove_base_domain
{}
...
...
lib/Ravada/Request.pm
View file @
4fab64a3
...
...
@@ -58,7 +58,7 @@ our %VALID_ARG = (
,
open_iptables
=>
$args_manage_iptables
,
remove_base
=>
$args_remove_base
,
prepare_base
=>
$args_prepare
,
spinoff
=>
{
id_domain
=>
1
}
,
spinoff
=>
{
id_domain
=>
1
,
uid
=>
1
}
,
pause_domain
=>
$args_manage
,
resume_domain
=>
{
%$args_manage
,
remote_ip
=>
1
}
,
remove_domain
=>
$args_manage
...
...
t/vm/s10_spinoff.t
View file @
4fab64a3
...
...
@@ -15,12 +15,17 @@ use Test::Ravada;
sub
test_spinoff
($base) {
my
$clone
=
$base
->
clone
(
name
=>
new_domain_name
,
user
=>
user_admin
);
is
(
$clone
->
id_base
,
$base
->
id
);
for
my
$vol
(
$clone
->
list_volumes_info
)
{
next
if
ref
(
$vol
)
=~
/ISO/
;
like
(
$vol
->
backing_file
,
qr(.)
,
$vol
->
file
)
or
exit
;
}
mangle_volume
(
$base
->
_vm
,
"
spinoff
",
$clone
->
list_volumes
);
$clone
->
spinoff
();
$clone
=
Ravada::
Domain
->
open
(
$clone
->
id
);
is
(
$clone
->
id_base
,
undef
)
or
exit
;
for
my
$vol
(
$clone
->
list_volumes_info
)
{
next
if
ref
(
$vol
)
=~
/ISO/
;
...
...
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