[pve-devel] [PATCH ha-manager 2/2] fixup node when failing migration because of wrong node

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Feb 5 17:51:17 CET 2016


When getting a EWRONG_NODE on a migration try the vm has already
moved.

As $cd holds in this case the node from the PVE::Cluster vm_list
call we should use that and mark it as started there.
This works for VMs and CTs, for possible other resources in the
future we must see.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

Could be sometimes seen when using the reproducing method
described in the previous patch.

 src/PVE/HA/Manager.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index 48826e7..91a65dc 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -436,7 +436,11 @@ sub next_state_migrate_relocate {
 	    return;
 	} else {
 	    $haenv->log('err', "service '$sid' - migration failed (exit code $exit_code)");
-	    &$change_service_state($self, $sid, 'started', node => $sd->{node});
+	    if ($exit_code == EWRONG_NODE) {
+		&$change_service_state($self, $sid, 'started', node => $cd->{node});
+	    } else {
+		&$change_service_state($self, $sid, 'started', node => $sd->{node});
+	    }
 	    return;
 	}
     }
-- 
2.1.4





More information about the pve-devel mailing list