]> git.proxmox.com Git - pve-container.git/commitdiff
migrate: also test unused volumes
authorFabian Ebner <f.ebner@proxmox.com>
Fri, 18 Jun 2021 10:59:31 +0000 (12:59 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 21 Jun 2021 08:40:27 +0000 (10:40 +0200)
otherwise an unused volume on a disabled storage is silently left on the old
node, even if referenced.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
src/PVE/LXC/Migrate.pm

index 95c5799ad2d070789e60d7d6d5003d0a0338ad1a..1e5cb1e924b00e288af885bcef2729c8aa2866da 100644 (file)
@@ -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) {