Add missing get_migration_status RPC definition
authorAndrea Spadaccini <spadaccio@google.com>
Fri, 28 Oct 2011 13:19:49 +0000 (14:19 +0100)
committerAndrea Spadaccini <spadaccio@google.com>
Fri, 28 Oct 2011 14:34:45 +0000 (15:34 +0100)
Add the instance_get_migration_status RPC definition and the needed
helper.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

lib/build/rpc_definitions.py
lib/rpc.py

index 79644b4..1e22549 100644 (file)
@@ -146,6 +146,9 @@ _INSTANCE_CALLS = [
     ("success", None, "Whether the migration succeeded or not"),
     ("live", None, "Whether the user requested a live migration or not"),
     ], None, "Finalize the instance migration on the source node"),
+  ("instance_get_migration_status", SINGLE, TMO_SLOW, [
+    ("instance", INST_TO_DICT, "Instance object"),
+    ], "self._MigrationStatusPostProc", "Report migration status"),
   ("instance_start", SINGLE, TMO_NORMAL, [
     ("instance_hvp_bep", "self._InstDictHvpBep(%s)", None),
     ("startup_paused", None, None),
index c4efad8..fcead58 100644 (file)
@@ -494,6 +494,12 @@ class RpcRunner(_generated_rpc.RpcClientDefault,
     return self._proc(node_list, procedure, body, read_timeout=timeout)
 
   @staticmethod
+  def _MigrationStatusPostProc(result):
+    if not result.fail_msg and result.payload is not None:
+      result.payload = objects.MigrationStatus.FromDict(result.payload)
+    return result
+
+  @staticmethod
   def _BlockdevFindPostProc(result):
     if not result.fail_msg and result.payload is not None:
       result.payload = objects.BlockDevStatus.FromDict(result.payload)