From 55b7e78356d233556fed6e43b51a417e64659120 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Sat, 24 Nov 2012 01:55:12 +0100
Subject: [PATCH] Rename OpTestAllocator.allocator to iallocator

This makes the OpCode more consistent with the other opcodes. The
downside is incompatibility when upgrading from 2.6, but since this is
a test opcode it shouldn't be problematic.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/client/gnt_debug.py | 2 +-
 lib/cmdlib.py           | 4 ++--
 lib/opcodes.py          | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/client/gnt_debug.py b/lib/client/gnt_debug.py
index 002fcc064..ffbd569c9 100644
--- a/lib/client/gnt_debug.py
+++ b/lib/client/gnt_debug.py
@@ -172,7 +172,7 @@ def TestAllocator(opts, args):
                                vcpus=opts.vcpus,
                                tags=opts.tags,
                                direction=opts.direction,
-                               allocator=opts.iallocator,
+                               iallocator=opts.iallocator,
                                evac_mode=opts.evac_mode,
                                target_groups=target_groups,
                                spindle_use=opts.spindle_use,
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 3b0999429..8ff1daeb5 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -15533,7 +15533,7 @@ class LUTestAllocator(NoHooksLU):
                                  self.op.mode, errors.ECODE_INVAL)
 
     if self.op.direction == constants.IALLOCATOR_DIR_OUT:
-      if self.op.allocator is None:
+      if self.op.iallocator is None:
         raise errors.OpPrereqError("Missing allocator name",
                                    errors.ECODE_INVAL)
     elif self.op.direction != constants.IALLOCATOR_DIR_IN:
@@ -15586,7 +15586,7 @@ class LUTestAllocator(NoHooksLU):
     if self.op.direction == constants.IALLOCATOR_DIR_IN:
       result = ial.in_text
     else:
-      ial.Run(self.op.allocator, validate=False)
+      ial.Run(self.op.iallocator, validate=False)
       result = ial.out_text
     return result
 
diff --git a/lib/opcodes.py b/lib/opcodes.py
index 9ff1a7df4..ba0940aab 100644
--- a/lib/opcodes.py
+++ b/lib/opcodes.py
@@ -1959,7 +1959,7 @@ class OpTestAllocator(OpCode):
       return the allocator output (direction 'out')
 
   """
-  OP_DSC_FIELD = "allocator"
+  OP_DSC_FIELD = "iallocator"
   OP_PARAMS = [
     ("direction", ht.NoDefault,
      ht.TElemOf(constants.VALID_IALLOCATOR_DIRECTIONS), None),
@@ -1973,7 +1973,7 @@ class OpTestAllocator(OpCode):
      None),
     ("disks", ht.NoDefault, ht.TMaybe(ht.TList), None),
     ("hypervisor", None, ht.TMaybeString, None),
-    ("allocator", None, ht.TMaybeString, None),
+    _PIAllocFromDesc(None),
     ("tags", ht.EmptyList, ht.TListOf(ht.TNonEmptyString), None),
     ("memory", None, ht.TMaybe(ht.TNonNegativeInt), None),
     ("vcpus", None, ht.TMaybe(ht.TNonNegativeInt), None),
-- 
GitLab