---
 lib/cmdlib.py  |   12 ++++++++++++
 lib/opcodes.py |    5 +++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index c637702..bdcdbff 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -12254,6 +12254,12 @@ class LUTestAllocator(NoHooksLU):
       if not hasattr(self.op, "evac_nodes"):
         raise errors.OpPrereqError("Missing attribute 'evac_nodes' on"
                                    " opcode input", errors.ECODE_INVAL)
+    elif self.op.mode == constants.IALLOCATOR_MODE_MRELOC:
+      if self.op.instances:
+        self.op.instances = _GetWantedInstances(self, self.op.instances)
+      else:
+        raise errors.OpPrereqError("Missing instances to relocate",
+                                   errors.ECODE_INVAL)
     else:
       raise errors.OpPrereqError("Invalid test allocator mode '%s'" %
                                  self.op.mode, errors.ECODE_INVAL)
@@ -12293,6 +12299,12 @@ class LUTestAllocator(NoHooksLU):
       ial = IAllocator(self.cfg, self.rpc,
                        mode=self.op.mode,
                        evac_nodes=self.op.evac_nodes)
+    elif self.op.mode == constants.IALLOCATOR_MODE_MRELOC:
+      ial = IAllocator(self.cfg, self.rpc,
+                       mode=self.op.mode,
+                       instances=self.op.instances,
+                       reloc_mode=self.op.reloc_mode,
+                       target_groups=self.op.target_groups)
     else:
       raise errors.ProgrammerError("Uncatched mode %s in"
                                    " LUTestAllocator.Exec", self.op.mode)
diff --git a/lib/opcodes.py b/lib/opcodes.py
index 698fb45..0cbd5cd 100644
--- a/lib/opcodes.py
+++ b/lib/opcodes.py
@@ -1430,6 +1430,11 @@ class OpTestAllocator(OpCode):
     ("disk_template", None, ht.TMaybeString, None),
     ("evac_nodes", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)),
      None),
+    ("instances", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)),
+     None),
+    ("reloc_mode", None, ht.TMaybeString, None),
+    ("target_groups", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)),
+     None),
     ]
 
 
-- 
1.7.3.5

Reply via email to