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
94bc4fa3
Unverified
Commit
94bc4fa3
authored
Apr 25, 2018
by
Fernando Verdugo
Committed by
GitHub
Apr 25, 2018
Browse files
Merge pull request #690 from UPC/656_raw
test: remove old volumes from multiple storage pools
parents
38e88d8d
932acc84
Changes
1
Hide whitespace changes
Inline
Side-by-side
t/lib/Test/Ravada.pm
View file @
94bc4fa3
...
...
@@ -256,20 +256,13 @@ sub _remove_old_disks_kvm {
}
# ok($vm,"I can't find a KVM virtual manager") or return;
my
$dir_img
;
eval
{
$dir_img
=
$vm
->
dir_img
()
};
return
if
!
$dir_img
;
$vm
->
_refresh_storage_pools
();
opendir
my
$ls
,
$dir_img
or
return
;
while
(
my
$disk
=
readdir
$ls
)
{
next
if
$disk
!~
/^${name}_\d+.*\.(img|raw|ro\.qcow2|qcow2)$/
;
$disk
=
"
$dir_img
/
$disk
";
next
if
!
-
f
$disk
;
unlink
$disk
or
next
;
#warn "I can't remove $disk";
for
my
$pool
(
$vm
->
vm
->
list_all_storage_pools
)
{
for
my
$volume
(
$pool
->
list_volumes
)
{
next
if
$volume
->
get_name
!~
/^${name}_\d+.*\.(img|raw|ro\.qcow2|qcow2)$/
;
$volume
->
delete
();
}
}
$vm
->
storage_pool
->
refresh
();
}
...
...
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