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
b24556ff
Commit
b24556ff
authored
Apr 05, 2022
by
Francesc Guasch
Browse files
wip: ease the base migration
parent
759c4a42
Changes
2
Show whitespace changes
Inline
Side-by-side
lib/Ravada/VM.pm
View file @
b24556ff
...
...
@@ -532,6 +532,9 @@ sub _around_import_domain {
my
$self
=
shift
;
my
(
$name
,
$user
,
$spinoff
,
$import_base
)
=
@_
;
die
"
Error: base for '
$name
' can't be imported when volumes are
"
.
"
spinned off
\n
"
if
$spinoff
&&
$import_base
;
my
$domain
=
$self
->
$orig
(
$name
,
$user
,
$spinoff
);
$domain
->
_insert_db
(
name
=>
$name
,
id_owner
=>
$user
->
id
);
...
...
script/rvd_back
View file @
b24556ff
...
...
@@ -491,16 +491,38 @@ sub import_domain {
$user
=
<
STDIN
>
;
chomp
$user
;
}
print
"
Do you want to spinoff the virtual machine volumes ? This will flatten the volumes out of backing files.
";
my
$spinoff_disks
=
_one_zero
(
_ask_yes_no
("
no
"));
my
$ravada
=
Ravada
->
new
(
%CONFIG
);
$ravada
->
import_domain
(
name
=>
$name
,
vm
=>
'
KVM
',
user
=>
$user
,
spinoff_disks
=>
$spinoff_disks
my
$domain
=
$ravada
->
import_domain
(
name
=>
$name
,
vm
=>
'
KVM
'
,
user
=>
$user
,
spinoff_disks
=>
0
);
print
"
$name
imported for user
$user
\n
";
my
@backing_files
;
for
my
$vol
(
$domain
->
list_volumes_info
)
{
push
@backing_files
,(
$vol
->
backing_file
)
if
$vol
->
backing_file
;
}
return
if
!
@backing_files
;
print
"
This virtual machine has
"
.
@backing_files
.
"
backing files.
"
.
"
Do you want to import it as a base ?
";
my
$import_base
=
_one_zero
(
_ask_yes_no
("
yes
"));
if
(
$import_base
)
{
$domain
->
_vm
->
_import_base
(
$domain
);
return
;
}
print
"
Do you want to spinoff the virtual machine volumes ? This will flatten the volumes out of backing files.
";
if
(
_one_zero
(
_ask_yes_no
("
no
"))
)
{
$domain
->
spinoff
;
if
(
@backing_files
)
{
print
"
This backing files may be removed:
\n
"
.
join
("
\n
",
@backing_files
)
.
"
\n
";
}
}
}
...
...
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