]> git.proxmox.com Git - pve-container.git/commitdiff
switch order of disk checks
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 11 Jul 2016 10:03:35 +0000 (12:03 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 11 Jul 2016 10:14:11 +0000 (12:14 +0200)
to make log message more meaningful.
'storage' < 'snapshot' < 'config'

src/PVE/LXC/Migrate.pm

index 185be074d4cdc29c064f81788f558d2faf28f3b7..83d2cb937da43619916b17c936a477ac5cec32d4 100644 (file)
@@ -157,17 +157,7 @@ sub phase1 {
        &$test_volid($volid, $snapname);
     };
 
-    # first all currently used volumes
-    PVE::LXC::Config->foreach_mountpoint($conf, $test_mp);
-
-    # then all volumes referenced in snapshots
-    foreach my $snapname (keys %{$conf->{snapshots}}) {
-       &$test_volid($conf->{snapshots}->{$snapname}->{'vmstate'}, 0, undef)
-           if defined($conf->{snapshots}->{$snapname}->{'vmstate'});
-       PVE::LXC::Config->foreach_mountpoint($conf->{snapshots}->{$snapname}, $test_mp, $snapname);
-    }
-
-    # finally unused / lost volumes owned by this container
+    # first unused / lost volumes owned by this container
     my @sids = PVE::Storage::storage_ids($self->{storecfg});
     foreach my $storeid (@sids) {
        my $scfg = PVE::Storage::storage_config($self->{storecfg}, $storeid);
@@ -185,12 +175,21 @@ sub phase1 {
        PVE::Storage::foreach_volid($dl, sub {
            my ($volid, $sid, $volname) = @_;
 
-           $self->log('info', "copy volume '$volid' to node '$self->{node}'")
-               if !$volhash->{$volid};
-           $volhash->{$volid} = 'storage' if !defined($volhash->{$volid});
+           $volhash->{$volid} = 'storage';
        });
     }
 
+    # then all volumes referenced in snapshots
+    foreach my $snapname (keys %{$conf->{snapshots}}) {
+       &$test_volid($conf->{snapshots}->{$snapname}->{'vmstate'}, 0, undef)
+           if defined($conf->{snapshots}->{$snapname}->{'vmstate'});
+       PVE::LXC::Config->foreach_mountpoint($conf->{snapshots}->{$snapname}, $test_mp, $snapname);
+    }
+
+    # finally all currently used volumes
+    PVE::LXC::Config->foreach_mountpoint($conf, $test_mp);
+
+
     # additional checks for local storage
     foreach my $volid (keys %$volhash) {
        my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);