Burnin: Use iallocator in import/export
authorGuido Trotter <ultrotter@google.com>
Sun, 15 Jun 2008 10:55:09 +0000 (10:55 +0000)
committerGuido Trotter <ultrotter@google.com>
Sun, 15 Jun 2008 10:55:09 +0000 (10:55 +0000)
Currently the iallocator option is ignored by burnin at import/export
time even if passed in. With this patch it becomes used. The log message
used by the importer is also changed to reflect this.

This patch also improves import/export on the non-iallocator case:
  - The secondary node is not passed anymore on non-mirrored templates
  - On mirrored templates the secondary node is logged

Reviewed-by: imsnah

tools/burnin

index 5d39766..c35a8c2 100755 (executable)
@@ -288,6 +288,19 @@ class Burner(object):
                  self.instances)
 
     for pnode, snode, enode, instance in mytor:
+
+      if self.opts.iallocator:
+        pnode = snode = None
+        import_log_msg = ("- Import instance %s from node %s (iallocator: %s)" %
+                          (instance, enode, self.opts.iallocator))
+      elif self.opts.disk_template not in constants.DTS_NET_MIRROR:
+        snode = None
+        import_log_msg = ("- Import instance %s from node %s to node %s" %
+                          (instance, enode, pnode))
+      else:
+        import_log_msg = ("- Import instance %s from node %s to nodes %s/%s" %
+                          (instance, enode, pnode, snode))
+
       exp_op = opcodes.OpExportInstance(instance_name=instance,
                                            target_node=enode,
                                            shutdown=True)
@@ -313,7 +326,8 @@ class Burner(object):
                                         wait_for_sync=True,
                                         mac="auto",
                                         file_storage_dir=None,
-                                        file_driver=None)
+                                        file_driver=None,
+                                        iallocator=self.opts.iallocator)
       erem_op = opcodes.OpRemoveExport(instance_name=instance)
 
       Log("- Export instance %s to node %s" % (instance, enode))
@@ -321,8 +335,7 @@ class Burner(object):
       Log("- Remove instance %s" % (instance))
       self.ExecOp(rem_op)
       self.to_rem.remove(instance)
-      Log("- Import instance %s from node %s to node %s" %
-          (instance, enode, pnode))
+      Log(import_log_msg)
       self.ExecOp(imp_op)
       Log("- Remove export of instance %s" % (instance))
       self.ExecOp(erem_op)