]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
Sim/Env: fix removing service from old node on migration
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 22 Dec 2015 07:52:38 +0000 (08:52 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 22 Dec 2015 09:24:26 +0000 (10:24 +0100)
We only removed the service from the source node on a relocate, we
also want to remove it on a successfull migration else we have it
on two nodes at the same time.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/HA/Sim/Env.pm

index 0d99ba0842170d7e3274361cf893c3380a177972..56b8bda5e92639919eb3f6c6d7745557716a575e 100644 (file)
@@ -345,17 +345,26 @@ sub exec_resource_agent {
 
            $self->log("info", "service $sid - start $cmd to node '$target'");
 
-           if ($cmd eq 'relocate' && $ss->{$sid}) {
-               $self->log("info", "stopping service $sid (relocate)");
-               $self->sleep(1);
-               $ss->{$sid} = 0;
-               $hardware->write_service_status($nodename, $ss);
+           if ($cmd eq 'relocate') {
+
+               if ($ss->{$sid}) {
+                   $self->log("info", "stopping service $sid (relocate)");
+                   $self->sleep(1); # time to stop service
+                   $ss->{$sid} = 0;
+                   $hardware->write_service_status($nodename, $ss);
+               }
+
                $self->log("info", "service status $sid stopped");
+
+           } else {
+               $self->sleep(2); # (live) migration time
            }
 
-           $self->sleep(2);
            $self->change_service_location($sid, $nodename, $target);
            $self->log("info", "service $sid - end $cmd to node '$target'");
+           # ensure that the old node doesn't has the service anymore
+           $ss->{$sid} = 0;
+           $hardware->write_service_status($nodename, $ss);
 
            return 0;