From 78212a5db5de43f8c71d74da278c1073d96927ac Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 4 Nov 2009 13:08:43 +0100
Subject: [PATCH] TLMigrateInstance: add error messagess during Exec
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently the migration of an instance doesn't show any error until the
end. We add two messages that show better the progress:

node1# gnt-instance migrate -f instance5
Wed Nov  4 04:04:34 2009 Migrating instance instance5
Wed Nov  4 04:04:34 2009 * checking disk consistency between source and target
Wed Nov  4 04:04:35 2009 * switching node node3 to secondary mode
Wed Nov  4 04:04:35 2009 * changing into standalone mode
Wed Nov  4 04:04:35 2009 * changing disks into dual-master mode
Wed Nov  4 04:04:40 2009 * wait until resync is done
Wed Nov  4 04:04:41 2009 * preparing node3 to accept the instance
Wed Nov  4 04:04:41 2009 * migrating instance to node3
Wed Nov  4 04:04:51 2009 Migration failed, aborting
Wed Nov  4 04:04:51 2009 * switching node node3 to secondary mode
Wed Nov  4 04:04:51 2009 * changing into standalone mode
Wed Nov  4 04:04:51 2009 * changing disks into single-master mode
Wed Nov  4 04:04:57 2009 * wait until resync is done
Failure: command execution error:
Could not migrate instance instance5: Failed to migrate instance: Failed
to migrate instance instance5: …

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/cmdlib.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 9b11c98ca..7f046ec1e 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -5147,6 +5147,7 @@ class TLMigrateInstance(Tasklet):
     if msg:
       logging.error("Instance pre-migration failed, trying to revert"
                     " disk status: %s", msg)
+      self.feedback_fn("Pre-migration failed, aborting")
       self._AbortMigration()
       self._RevertDiskStatus()
       raise errors.OpExecError("Could not pre-migrate instance %s: %s" %
@@ -5161,6 +5162,7 @@ class TLMigrateInstance(Tasklet):
     if msg:
       logging.error("Instance migration failed, trying to revert"
                     " disk status: %s", msg)
+      self.feedback_fn("Migration failed, aborting")
       self._AbortMigration()
       self._RevertDiskStatus()
       raise errors.OpExecError("Could not migrate instance %s: %s" %
-- 
GitLab