From 036b441d76759989fe2424c5f8a1eaa20f083449 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Wed, 23 Apr 2008 10:58:53 +0000 Subject: [PATCH] Allow burnin to use an iallocator in instance creation This patch adds iallocator support to burnin, currently only in instance creation. This means that, depending on the external algorithm, not all nodes might get instances. The patch also restricts node selection and iallocator options together. Reviewed-by: ultrotter --- tools/burnin | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/burnin b/tools/burnin index 2f6993f..cf75f14 100755 --- a/tools/burnin +++ b/tools/burnin @@ -138,6 +138,11 @@ class Burner(object): parser.add_option("-n", "--nodes", dest="nodes", default="", help="Comma separated list of nodes to perform" " the burnin on (defaults to all nodes)") + parser.add_option("--iallocator", dest="iallocator", + default=None, type="string", + help="Perform the allocation using an iallocator" + " instead of fixed node spread (node restrictions no" + " longer apply, therefore -n/--nodes must not be used") options, args = parser.parse_args() if len(args) < 1 or options.os is None: @@ -150,6 +155,10 @@ class Burner(object): Log("Unknown disk template '%s'" % options.disk_template) sys.exit(1) + if options.nodes and options.iallocator: + Log("Give either the nodes option or the iallocator option, not both") + sys.exit(1) + self.opts = options self.instances = args @@ -198,6 +207,8 @@ class Burner(object): islice(cycle(self.nodes), 1, None), self.instances) for pnode, snode, instance in mytor: + if self.opts.iallocator: + pnode = snode = None op = opcodes.OpCreateInstance(instance_name=instance, mem_size=128, disk_size=self.opts.os_size, @@ -214,7 +225,8 @@ class Burner(object): mac="auto", kernel_path=None, initrd_path=None, - hvm_boot_order=None) + hvm_boot_order=None, + iallocator=self.opts.iallocator) Log("- Add instance %s on nodes %s/%s" % (instance, pnode, snode)) self.ExecOp(op) self.to_rem.append(instance) -- 1.7.10.4