From 5b9107ff5887e0e135365681426b08dc206cb0ed Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 21 Aug 2009 16:23:16 +0200
Subject: [PATCH] Add burnin support for instance moves

This patch adds support for instance moves in burnin. This means that
non-drbd instances finally get support for being moved.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 tools/burnin | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tools/burnin b/tools/burnin
index c445fb3ca..817aad6ad 100755
--- a/tools/burnin
+++ b/tools/burnin
@@ -128,6 +128,9 @@ OPTIONS = [
   cli.cli_option("--no-migrate", dest="do_migrate",
                  help="Skip instance live migration",
                  action="store_false", default=True),
+  cli.cli_option("--no-move", dest="do_move",
+                 help="Skip instance moves", action="store_false",
+                 default=True),
   cli.cli_option("--no-importexport", dest="do_importexport",
                  help="Skip instance export/import", action="store_false",
                  default=True),
@@ -562,7 +565,19 @@ class Burner(object):
       Log("instance %s" % instance, indent=1)
       op = opcodes.OpFailoverInstance(instance_name=instance,
                                       ignore_consistency=False)
+      self.ExecOrQueue(instance, op)
 
+  @_DoCheckInstances
+  @_DoBatch(False)
+  def BurnMove(self):
+    """Move the instances."""
+    Log("Moving instances")
+    mytor = izip(islice(cycle(self.nodes), 1, None),
+                 self.instances)
+    for tnode, instance in mytor:
+      Log("instance %s" % instance, indent=1)
+      op = opcodes.OpMoveInstance(instance_name=instance,
+                                  target_node=tnode)
       self.ExecOrQueue(instance, op)
 
   @_DoBatch(False)
@@ -845,6 +860,10 @@ class Burner(object):
       if opts.do_migrate and opts.disk_template == constants.DT_DRBD8:
         self.BurnMigrate()
 
+      if opts.do_move and opts.disk_template in [constants.DT_PLAIN,
+                                                 constants.DT_FILE]:
+        self.BurnMove()
+
       if (opts.do_importexport and
           opts.disk_template not in (constants.DT_DISKLESS,
                                      constants.DT_FILE)):
-- 
GitLab