diff --git a/lib/client/gnt_debug.py b/lib/client/gnt_debug.py
index f7acc740584a6d5951e6eb30d0e7cf93e70af89a..ebc6af10f77d4c69da1aa57a7db95187e793fe34 100644
--- a/lib/client/gnt_debug.py
+++ b/lib/client/gnt_debug.py
@@ -175,7 +175,8 @@ def TestAllocator(opts, args):
                                allocator=opts.iallocator,
                                evac_mode=opts.evac_mode,
                                target_groups=target_groups,
-                               spindle_use=opts.spindle_use)
+                               spindle_use=opts.spindle_use,
+                               count=opts.count)
   result = SubmitOpCode(op, opts=opts)
   ToStdout("%s" % result)
   return 0
@@ -676,6 +677,8 @@ commands = {
                 default=[], action="append"),
      cli_option("--spindle-use", help="How many spindles to use",
                 default=1, type="int"),
+     cli_option("--count", help="How many instances to allocate",
+                default=2, type="int"),
      DRY_RUN_OPT, PRIORITY_OPT,
      ],
     "{opts...} <instance>", "Executes a TestAllocator OpCode"),
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 856d283173cccdc6634541ba8da1114d30e1ca5f..606bfd60f460eaac31d2624632a10a57661c88fc 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -14824,7 +14824,8 @@ class LUTestAllocator(NoHooksLU):
     This checks the opcode parameters depending on the director and mode test.
 
     """
-    if self.op.mode == constants.IALLOCATOR_MODE_ALLOC:
+    if self.op.mode in (constants.IALLOCATOR_MODE_ALLOC,
+                        constants.IALLOCATOR_MODE_MULTI_ALLOC):
       for attr in ["memory", "disks", "disk_template",
                    "os", "tags", "nics", "vcpus"]:
         if not hasattr(self.op, attr):
@@ -14896,6 +14897,20 @@ class LUTestAllocator(NoHooksLU):
     elif self.op.mode == constants.IALLOCATOR_MODE_NODE_EVAC:
       req = iallocator.IAReqNodeEvac(instances=self.op.instances,
                                      evac_mode=self.op.evac_mode)
+    elif self.op.mode == constants.IALLOCATOR_MODE_MULTI_ALLOC:
+      disk_template = self.op.disk_template
+      insts = [iallocator.IAReqInstanceAlloc(name="%s%s" % (self.op.name, idx),
+                                             memory=self.op.memory,
+                                             disks=self.op.disks,
+                                             disk_template=disk_template,
+                                             os=self.op.os,
+                                             tags=self.op.tags,
+                                             nics=self.op.nics,
+                                             vcpus=self.op.vcpus,
+                                             spindle_use=self.op.spindle_use,
+                                             hypervisor=self.op.hypervisor)
+               for idx in range(self.op.count)]
+      req = iallocator.IAReqMultiInstanceAlloc(instances=insts)
     else:
       raise errors.ProgrammerError("Uncatched mode %s in"
                                    " LUTestAllocator.Exec", self.op.mode)
diff --git a/lib/opcodes.py b/lib/opcodes.py
index 9c2bbcd1fd2dda2ed839ea1413d79651c74fe600..e4ad078e22ec16aee25b1065b599de7a8b2305f5 100644
--- a/lib/opcodes.py
+++ b/lib/opcodes.py
@@ -1839,6 +1839,7 @@ class OpTestAllocator(OpCode):
      ht.TOr(ht.TNone, ht.TElemOf(constants.IALLOCATOR_NEVAC_MODES)), None),
     ("target_groups", None, ht.TMaybeListOf(ht.TNonEmptyString), None),
     ("spindle_use", 1, ht.TPositiveInt, None),
+    ("count", 1, ht.TPositiveInt, None),
     ]