}
$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) = @_;
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"
# 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;
}
};
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;
$self->log('info', "copy volume '$volid' to node '$self->{node}'")
if !$volhash->{$volid};
- $volhash->{$volid} = 1;
+ $volhash->{$volid} = 'storage' if !defined($volhash->{$volid});
});
}
}
}
+ 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;