]> git.proxmox.com Git - qemu-server.git/commitdiff
Revert "Integrate replica in the qemu migration."
authorDietmar Maurer <dietmar@proxmox.com>
Sat, 6 May 2017 08:39:43 +0000 (10:39 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 6 May 2017 08:39:43 +0000 (10:39 +0200)
This reverts commit 63d02c707429efcd509ddb14d3fd560cfcf4979e.

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}.

PVE/QemuMigrate.pm

index d25e8be65bcac8c64eb81ed937a3208f1be76dec..5caac15f397c3c79dae1a253c151d13b61e2de4a 100644 (file)
@@ -10,7 +10,6 @@ use PVE::INotify;
 use PVE::Tools;
 use PVE::Cluster;
 use PVE::Storage;
-use PVE::ReplicationTools;
 use PVE::QemuServer;
 use Time::HiRes qw( usleep );
 use PVE::RPCEnvironment;
@@ -438,16 +437,6 @@ sub phase1 {
 
     sync_disks($self, $vmid);
 
-    # 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::QemuConfig->write_config($vmid, $conf);
-    }
 };
 
 sub phase1_cleanup {
@@ -855,22 +844,13 @@ sub phase3 {
     my $volids = $self->{volumes};
     return if $self->{phase2errors};
 
-    my $synced_volumes = PVE::ReplicationTools::get_syncable_guestdisks($self->{vmconf}, 'qemu')
-       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$/;
        }
     }
 }
@@ -984,11 +964,6 @@ sub phase3_cleanup {
     # clear migrate lock
     my $cmd = [ @{$self->{rem_ssh}}, 'qm', 'unlock', $vmid ];
     $self->cmd_logerr($cmd, errmsg => "failed to clear migrate lock");
-
-    if ($self->{vmconf}->{replica}) {
-       my $cmd = [ @{$self->{rem_ssh}}, 'qm', 'set', $vmid, '--replica'];
-       $self->cmd_logerr($cmd, errmsg => "failed to activate replica");
-    }
 }
 
 sub final_cleanup {