Check that the instance is not being migrated to its current primary node during CheckPrereq. Otherwise migration is aborted because the instance is already running and cleaned-up, which causes the running instance to be killed.
Signed-off-by: Apollon Oikonomopoulos <[email protected]> --- lib/cmdlib.py | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 0c24ecd..036a729 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -6471,6 +6471,10 @@ class TLMigrateInstance(Tasklet): # self.target_node is already populated, either directly or by the # iallocator run target_node = self.target_node + if self.target_node == instance.primary_node: + raise errors.OpPrereqError("Cannot migrate instance %s" + " to its primary (%s)" % + (instance.name, instance.primary_node)) if len(self.lu.tasklets) == 1: # It is safe to release locks only when we're the only tasklet -- 1.7.2.5
