+ my $format = PVE::QemuServer::qemu_img_format($scfg, $volname);
+ $local_volumes->{$volid}->{snapshots} = defined($snaprefs) || ($format =~ /^(?:qcow2|vmdk)$/);
+ if (defined($snaprefs)) {
+ # we cannot migrate shapshots on local storage
+ # exceptions: 'zfspool' or 'qcow2' files (on directory storage)
+
+ die "online storage migration not possible if snapshot exists\n" if $self->{running};
+ if (!($scfg->{type} eq 'zfspool' || $format eq 'qcow2')) {
+ die "non-migratable snapshot exists\n";
+ }
+ }
+
+ die "referenced by linked clone(s)\n"
+ if PVE::Storage::volume_is_base_and_used($self->{storecfg}, $volid);
+ };
+
+ PVE::QemuServer::foreach_volid($conf, sub {
+ my ($volid, $attr) = @_;
+ eval { $test_volid->($volid, $attr); };
+ if (my $err = $@) {
+ &$log_error($err, $volid);
+ }
+ });
+
+ foreach my $vol (sort keys %$local_volumes) {
+ my $ref = $local_volumes->{$vol}->{ref};
+ if ($ref eq 'storage') {
+ $self->log('info', "found local disk '$vol' (via storage)\n");
+ } elsif ($ref eq 'config') {
+ &$log_error("can't live migrate attached local disks without with-local-disks option\n", $vol)
+ if $self->{running} && !$self->{opts}->{"with-local-disks"};
+ $self->log('info', "found local disk '$vol' (in current VM config)\n");
+ } elsif ($ref eq 'snapshot') {
+ $self->log('info', "found local disk '$vol' (referenced by snapshot(s))\n");
+ } else {
+ $self->log('info', "found local disk '$vol'\n");
+ }
+ }
+
+ foreach my $vol (sort keys %$local_volumes_errors) {
+ $self->log('warn', "can't migrate local disk '$vol': $local_volumes_errors->{$vol}");
+ }
+ foreach my $err (@$other_errors) {
+ $self->log('warn', "$err");
+ }