Add burnin support for instance moves
authorIustin Pop <iustin@google.com>
Fri, 21 Aug 2009 14:23:16 +0000 (16:23 +0200)
committerIustin Pop <iustin@google.com>
Mon, 24 Aug 2009 15:14:16 +0000 (17:14 +0200)
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

index c445fb3..817aad6 100755 (executable)
@@ -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)):