]> git.proxmox.com Git - pve-container.git/commitdiff
collect and log origin of found local volumes
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 11 Jul 2016 10:03:34 +0000 (12:03 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 11 Jul 2016 10:14:11 +0000 (12:14 +0200)
just knowing that local disks prevent a migration is not
very helpful, so be a bit more verbose here.

src/PVE/LXC/Migrate.pm

index fbcb8c772b81fe7b6b753237627061a2a4c8230a..185be074d4cdc29c064f81788f558d2faf28f3b7 100644 (file)
@@ -100,7 +100,7 @@ sub phase1 {
     }
 
     $self->{volumes} = []; # list of already migrated volumes
-    my $volhash = {}; # 1 for local volumes
+    my $volhash = {}; # 'config', 'snapshot' or 'storage' for local volumes
 
     my $test_volid = sub {
        my ($volid, $snapname) = @_;
@@ -115,6 +115,8 @@ sub phase1 {
 
        return if $scfg->{shared};
 
+       $volhash->{$volid} = defined($snapname) ? 'snapshot' : 'config';
+
        my ($path, $owner) = PVE::Storage::path($self->{storecfg}, $volid);
 
        die "can't migrate volume '$volid' - owned by other guest (owner = $owner)\n"
@@ -124,12 +126,9 @@ sub phase1 {
            # we cannot migrate shapshots on local storage
            # exceptions: 'zfspool'
            if (($scfg->{type} eq 'zfspool')) {
-               $volhash->{$volid} = 1;
                return;
            }
            die "can't migrate snapshot of local volume '$volid'\n";
-       } else {
-           $volhash->{$volid} = 1;
        }
     };
 
@@ -151,7 +150,6 @@ sub phase1 {
        if (!$scfg->{shared}) {
            $self->log('info', "copy mountpoint '$ms' ($volid) to node ' $self->{node}'")
                if !$snapname;
-           $volhash->{$volid} = 1;
        } else {
            $self->log('info', "mountpoint '$ms' is on shared storage '$storage'")
                if !$snapname;
@@ -189,7 +187,7 @@ sub phase1 {
 
            $self->log('info', "copy volume '$volid' to node '$self->{node}'")
                if !$volhash->{$volid};
-           $volhash->{$volid} = 1;
+           $volhash->{$volid} = 'storage' if !defined($volhash->{$volid});
        });
     }
 
@@ -210,6 +208,18 @@ sub phase1 {
        }
     }
 
+    foreach my $volid (sort keys %$volhash) {
+       if ($volhash->{$volid} eq 'storage') {
+           $self->log('info', "found local volume '$volid' (via storage)\n");
+       } elsif ($volhash->{$volid} eq 'config') {
+           $self->log('info', "found local volume '$volid' (in current VM config)\n");
+       } elsif ($volhash->{$volid} eq 'snapshot') {
+           $self->log('info', "found local volume '$volid' (referenced by snapshot(s))\n");
+       } else {
+           $self->log('info', "found local volume '$volid'\n");
+       }
+    }
+
     foreach my $volid (keys %$volhash) {
        my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
        push @{$self->{volumes}}, $volid;