From 2334b15da7c99896a2e1887ef71b53f52fd20121 Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Fri, 18 Jun 2021 12:59:31 +0200 Subject: [PATCH] migrate: also test unused volumes otherwise an unused volume on a disabled storage is silently left on the old node, even if referenced. Signed-off-by: Fabian Ebner --- src/PVE/LXC/Migrate.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/PVE/LXC/Migrate.pm b/src/PVE/LXC/Migrate.pm index 95c5799..1e5cb1e 100644 --- a/src/PVE/LXC/Migrate.pm +++ b/src/PVE/LXC/Migrate.pm @@ -44,7 +44,7 @@ sub prepare { } $self->{was_running} = $running; - PVE::LXC::Config->foreach_volume($conf, sub { + PVE::LXC::Config->foreach_volume_full($conf, { include_unused => 1 }, sub { my ($ms, $mountpoint) = @_; my $volid = $mountpoint->{volume}; @@ -186,7 +186,7 @@ sub phase1 { next if $scfg->{shared}; next if !PVE::Storage::storage_check_enabled($self->{storecfg}, $storeid, undef, 1); - # get list from PVE::Storage (for unused volumes) + # get list from PVE::Storage (for unreferenced volumes) my $dl = PVE::Storage::vdisk_list($self->{storecfg}, $storeid, $vmid); next if @{$dl->{$storeid}} == 0; @@ -208,9 +208,8 @@ sub phase1 { PVE::LXC::Config->foreach_volume($conf->{snapshots}->{$snapname}, $test_mp, $snapname); } - # finally all currently used volumes - PVE::LXC::Config->foreach_volume($conf, $test_mp); - + # finally all current volumes + PVE::LXC::Config->foreach_volume_full($conf, { include_unused => 1 }, $test_mp); # additional checks for local storage foreach my $volid (keys %$volhash) { -- 2.39.2