]> git.proxmox.com Git - pve-container.git/blobdiff - src/PVE/LXC/Migrate.pm
adapt to new storage_migrate activation behavior
[pve-container.git] / src / PVE / LXC / Migrate.pm
index d0be6d43dd1b931a4f070745b5dae3d9277055c7..94a78c57952c18a85ed32393dc8af783aab6d555 100644 (file)
@@ -45,7 +45,6 @@ sub prepare {
     $self->{was_running} = $running;
 
     my $force = $self->{opts}->{force} // 0;
-    my $need_activate = [];
 
     PVE::LXC::Config->foreach_volume($conf, sub {
        my ($ms, $mountpoint) = @_;
@@ -80,9 +79,6 @@ sub prepare {
            warn "Used shared storage '$storage' is not online on source node!\n"
                if !$plugin->check_connection($storage, $scfg);
        } else {
-           # only activate if not shared
-           push @$need_activate, $volid;
-
            # unless in restart mode because we shut the container down
            die "unable to migrate local mount point '$volid' while CT is running"
                if $running && !$restart;
@@ -90,8 +86,6 @@ sub prepare {
 
     });
 
-    PVE::Storage::activate_volumes($self->{storecfg}, $need_activate);
-
     # todo: test if VM uses local resources
 
     # test ssh connection
@@ -287,12 +281,19 @@ sub phase1 {
        $bwlimit = $bwlimit * 1024 if defined($bwlimit);
 
        my $storage_migrate_opts = {
-           'bwlimit' => $bwlimit,
+           'ratelimit_bps' => $bwlimit,
            'insecure' => $opts->{migration_type} eq 'insecure',
            'with_snapshots' => $volhash->{$volid}->{snapshots},
        };
 
-       PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{ssh_info}, $sid, $storage_migrate_opts);
+       my $logfunc = sub { $self->log('info', $_[0]); };
+       eval {
+           PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{ssh_info},
+                                         $sid, $storage_migrate_opts, $logfunc);
+       };
+       if (my $err = $@) {
+           die "storage migration for '$volid' to storage '$sid' failed - $err\n";
+       }
     }
 
     my $conffile = PVE::LXC::Config->config_file($vmid);