[pve-devel] [PATCH container 2/3] switch order of disk checks

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Jul 7 16:45:26 CEST 2016


to make log message more meaningful.
'storage' < 'snapshot' < 'config'
---
Note: the 'copy volume ...' message is no longer needed, as we
display a summary of found (and thus copied) local volumes anyway

 src/PVE/LXC/Migrate.pm | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/PVE/LXC/Migrate.pm b/src/PVE/LXC/Migrate.pm
index 185be07..83d2cb9 100644
--- a/src/PVE/LXC/Migrate.pm
+++ b/src/PVE/LXC/Migrate.pm
@@ -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);
-- 
2.1.4





More information about the pve-devel mailing list