[pve-devel] [PATCH pve-ha-manager 1/4] Sim/Env: fix removing service from old node on migration

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Dec 21 12:52:53 CET 2015


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 at proxmox.com>
---
 src/PVE/HA/Sim/Env.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/PVE/HA/Sim/Env.pm b/src/PVE/HA/Sim/Env.pm
index 0d99ba0..04801dc 100644
--- a/src/PVE/HA/Sim/Env.pm
+++ b/src/PVE/HA/Sim/Env.pm
@@ -348,14 +348,15 @@ sub exec_resource_agent {
 	    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);
 		$self->log("info", "service status $sid stopped");
 	    }
 
 	    $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;
 
-- 
2.1.4





More information about the pve-devel mailing list