From b21d8c7fedfa0b3af54a6ad05ba1fde40e2dce84 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 30 Jul 2009 17:53:10 +0200
Subject: [PATCH] gnt-node: Use new opcode to migrate node

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 scripts/gnt-node | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/scripts/gnt-node b/scripts/gnt-node
index b87c8e860..10cddd79c 100755
--- a/scripts/gnt-node
+++ b/scripts/gnt-node
@@ -299,20 +299,8 @@ def MigrateNode(opts, args):
                                (",".join("'%s'" % name for name in pinst))):
     return 2
 
-  jex = JobExecutor(cl=cl)
-  for iname in pinst:
-    op = opcodes.OpMigrateInstance(instance_name=iname, live=opts.live,
-                                   cleanup=False)
-    jex.QueueJob(iname, op)
-
-  results = jex.GetResults()
-  bad_cnt = len([row for row in results if not row[0]])
-  if bad_cnt == 0:
-    ToStdout("All %d instance(s) migrated successfully.", len(results))
-  else:
-    ToStdout("There were errors during the migration:\n"
-             "%d error(s) out of %d instance(s).", bad_cnt, len(results))
-  return retcode
+  op = opcodes.OpMigrateNode(node_name=args[0], live=opts.live)
+  SubmitOpCode(op, cl=cl)
 
 
 def ShowNodeConfig(opts, args):
-- 
GitLab