Commit 932acc84 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#656] remove old volumes from multiple storage pools

parent 70c989fd
......@@ -250,20 +250,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();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment