]> git.proxmox.com Git - pve-container.git/commitdiff
Revert "Integrate storage replica in lxc migration."
authorDietmar Maurer <dietmar@proxmox.com>
Sat, 6 May 2017 09:06:35 +0000 (11:06 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 6 May 2017 09:06:35 +0000 (11:06 +0200)
This reverts commit 05309cdf3f460733ec00184c0f45350f854d3737.

The commit changes the configuration before the VM is actually
migrated, so it is possible to have a wrong configuration when
migration fails for some reason. Also, I am quite unsure if
this automatic target change is really wanted. The patch also
contains wrong refereces to $self->{opts}->{node}.

src/PVE/LXC/Migrate.pm

index 0d3452825daa6620a148ea86a6e612920f206226..6b9687b8904735ce8e8e6fc60999b2a0bb24aa19 100644 (file)
@@ -10,7 +10,6 @@ use PVE::INotify;
 use PVE::Cluster;
 use PVE::Storage;
 use PVE::LXC;
-use PVE::ReplicationTools;
 
 use base qw(PVE::AbstractMigrate);
 
@@ -271,17 +270,6 @@ sub phase1 {
        PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{nodeip}, $sid);
     }
 
-    # set new replica_target if we migrate to replica target.
-    if ($conf->{replica}) {
-       $self->log('info', "change replica target to Node: $self->{opts}->{node}");
-       if ($conf->{replica_target} eq $self->{node}) {
-           $conf->{replica_target} = $self->{opts}->{node};
-       }
-
-       PVE::ReplicationTools::job_remove($vmid);
-       PVE::LXC::Config->write_config($vmid, $conf);
-    }
-
     my $conffile = PVE::LXC::Config->config_file($vmid);
     my $newconffile = PVE::LXC::Config->config_file($vmid, $self->{node});
 
@@ -324,20 +312,13 @@ sub phase3 {
 
     my $volids = $self->{volumes};
 
-    my $synced_volumes = PVE::ReplicationTools::get_syncable_guestdisks($self->{vmconf}, 'lxc')
-       if $self->{vmconf}->{replica};
-
     # destroy local copies
     foreach my $volid (@$volids) {
-       # do not destroy if new target is local_host
-       if (!($self->{vmconf}->{replica} && defined($synced_volumes->{$volid})
-             && $self->{vmconf}->{replica_target} eq $self->{opts}->{node}) ) {
-           eval { PVE::Storage::vdisk_free($self->{storecfg}, $volid); };
-           if (my $err = $@) {
-               $self->log('err', "removing local copy of '$volid' failed - $err");
-               $self->{errors} = 1;
-               last if $err =~ /^interrupted by signal$/;
-           }
+       eval { PVE::Storage::vdisk_free($self->{storecfg}, $volid); };
+       if (my $err = $@) {
+           $self->log('err', "removing local copy of '$volid' failed - $err");
+           $self->{errors} = 1;
+           last if $err =~ /^interrupted by signal$/;
        }
     }
 }
@@ -360,11 +341,6 @@ sub final_cleanup {
        $self->cmd_logerr($cmd, errmsg => "failed to clear migrate lock");      
     }
 
-    if ($self->{vmconf}->{replica}) {
-       my $cmd = [ @{$self->{rem_ssh}}, 'pct', 'set', $vmid, '--replica'];
-       $self->cmd_logerr($cmd, errmsg => "failed to activate replica");
-    }
-
     # in restart mode, we start the container on the target node
     # after migration
     if ($self->{opts}->{restart} && $self->{was_running}) {