diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index b6adbfe25b3262d51bb8d9c4f18f136528cbdee0..2ce59839ff0d1907ed5e19539f085e821e3d5d29 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -8861,6 +8861,10 @@ class LUTestAllocator(NoHooksLU):
       fname = _ExpandInstanceName(self.cfg, self.op.name)
       self.op.name = fname
       self.relocate_from = self.cfg.GetInstanceInfo(fname).secondary_nodes
+    elif self.op.mode == constants.IALLOCATOR_MODE_MEVAC:
+      if not hasattr(self.op, "evac_nodes"):
+        raise errors.OpPrereqError("Missing attribute 'evac_nodes' on"
+                                   " opcode input", errors.ECODE_INVAL)
     else:
       raise errors.OpPrereqError("Invalid test allocator mode '%s'" %
                                  self.op.mode, errors.ECODE_INVAL)
@@ -8890,12 +8894,19 @@ class LUTestAllocator(NoHooksLU):
                        vcpus=self.op.vcpus,
                        hypervisor=self.op.hypervisor,
                        )
-    else:
+    elif self.op.mode == constants.IALLOCATOR_MODE_RELOC:
       ial = IAllocator(self.cfg, self.rpc,
                        mode=self.op.mode,
                        name=self.op.name,
                        relocate_from=list(self.relocate_from),
                        )
+    elif self.op.mode == constants.IALLOCATOR_MODE_MEVAC:
+      ial = IAllocator(self.cfg, self.rpc,
+                       mode=self.op.mode,
+                       evac_nodes=self.op.evac_nodes)
+    else:
+      raise errors.ProgrammerError("Uncatched mode %s in"
+                                   " LUTestAllocator.Exec", self.op.mode)
 
     if self.op.direction == constants.IALLOCATOR_DIR_IN:
       result = ial.in_text
diff --git a/lib/opcodes.py b/lib/opcodes.py
index b72204f23ecf50fa521a7532c4588b7a7340a898..dc5ac6c27949d609db2115fc045c59f9600d8403 100644
--- a/lib/opcodes.py
+++ b/lib/opcodes.py
@@ -725,6 +725,7 @@ class OpTestAllocator(OpCode):
     "direction", "mode", "allocator", "name",
     "mem_size", "disks", "disk_template",
     "os", "tags", "nics", "vcpus", "hypervisor",
+    "evac_nodes",
     ]
 
 
diff --git a/scripts/gnt-debug b/scripts/gnt-debug
index 532a4c77e064dff5203255b9bdb0a9d03289466c..5dc7dc63045f3ee9fb7b7c66c5784a84381bc44a 100755
--- a/scripts/gnt-debug
+++ b/scripts/gnt-debug
@@ -140,6 +140,7 @@ def TestAllocator(opts, args):
 
   op = opcodes.OpTestAllocator(mode=opts.mode,
                                name=args[0],
+                               evac_nodes=args,
                                mem_size=opts.mem,
                                disks=disks,
                                disk_template=opts.disk_template,
@@ -177,14 +178,14 @@ commands = {
     "<op_list_file...>", "Submits jobs built from json files"
     " containing a list of serialized opcodes"),
   'allocator': (
-    TestAllocator, ARGS_ONE_INSTANCE,
+    TestAllocator, [ArgUnknown(min=1)],
     [cli_option("--dir", dest="direction",
                 default="in", choices=["in", "out"],
                 help="Show allocator input (in) or allocator"
                 " results (out)"),
      IALLOCATOR_OPT,
      cli_option("-m", "--mode", default="relocate",
-                choices=["relocate", "allocate"],
+                choices=["relocate", "allocate", "multi-evacuate"],
                 help="Request mode, either allocate or relocate"),
      cli_option("--mem", default=128, type="unit",
                 help="Memory size for the instance (MiB)"),