commit dd47a0f073593b714a43b33256aef83f75860e6a
Author: Iustin Pop <iustin@google.com>
Date:   Mon May 30 13:14:18 2011 +0200

    iallocator: rename mem_size to memory
    
    Currently, the iallocator in 'allocate' requires mem_size on input
    but serialises that as 'memory'. This inconsistency makes it hard to
    automatically validate the parameters, hence this patch renames
    mem_size.
    
    Signed-off-by: Iustin Pop <iustin@google.com>
    Reviewed-by: Michael Hanselmann <hansmi@google.com>

diff --git a/lib/client/gnt_debug.py b/lib/client/gnt_debug.py
index 6985781..8065dd7 100644
--- a/lib/client/gnt_debug.py
+++ b/lib/client/gnt_debug.py
@@ -164,7 +164,7 @@ def TestAllocator(opts, args):
                                name=args[0],
                                evac_nodes=args,
                                instances=args,
-                               mem_size=opts.mem,
+                               memory=opts.memory,
                                disks=disks,
                                disk_template=opts.disk_template,
                                nics=nic_dict,
@@ -568,7 +568,7 @@ commands = {
                 choices=list(constants.VALID_IALLOCATOR_MODES),
                 help=("Request mode (one of %s)" %
                       utils.CommaJoin(constants.VALID_IALLOCATOR_MODES))),
-     cli_option("--mem", default=128, type="unit",
+     cli_option("--memory", default=128, type="unit",
                 help="Memory size for the instance (MiB)"),
      cli_option("--disks", default="4096,4096",
                 help="Comma separated list of disk sizes (MiB)"),
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 495edac..dab6f26 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -8003,7 +8003,7 @@ class LUInstanceCreate(LogicalUnit):
                      tags=[],
                      os=self.op.os_type,
                      vcpus=self.be_full[constants.BE_VCPUS],
-                     mem_size=self.be_full[constants.BE_MEMORY],
+                     memory=self.be_full[constants.BE_MEMORY],
                      disks=self.disks,
                      nics=nics,
                      hypervisor=self.op.hypervisor,
@@ -12005,7 +12005,7 @@ class IAllocator(object):
     self.in_text = self.out_text = self.in_data = self.out_data = None
     # init all input fields so that pylint is happy
     self.mode = mode
-    self.mem_size = self.disks = self.disk_template = None
+    self.memory = self.disks = self.disk_template = None
     self.os = self.tags = self.nics = self.vcpus = None
     self.hypervisor = None
     self.relocate_from = None
@@ -12245,7 +12245,7 @@ class IAllocator(object):
       "tags": self.tags,
       "os": self.os,
       "vcpus": self.vcpus,
-      "memory": self.mem_size,
+      "memory": self.memory,
       "disks": self.disks,
       "disk_space_total": disk_space,
       "nics": self.nics,
@@ -12325,7 +12325,7 @@ class IAllocator(object):
   _MODE_DATA = {
     constants.IALLOCATOR_MODE_ALLOC:
       (_AddNewInstance,
-       ["name", "mem_size", "disks", "disk_template", "os", "tags", "nics",
+       ["name", "memory", "disks", "disk_template", "os", "tags", "nics",
         "vcpus", "hypervisor"], ht.TList),
     constants.IALLOCATOR_MODE_RELOC:
       (_AddRelocateInstance, ["name", "relocate_from"], ht.TList),
@@ -12473,7 +12473,7 @@ class LUTestAllocator(NoHooksLU):
 
     """
     if self.op.mode == constants.IALLOCATOR_MODE_ALLOC:
-      for attr in ["mem_size", "disks", "disk_template",
+      for attr in ["memory", "disks", "disk_template",
                    "os", "tags", "nics", "vcpus"]:
         if not hasattr(self.op, attr):
           raise errors.OpPrereqError("Missing attribute '%s' on opcode input" %
@@ -12532,7 +12532,7 @@ class LUTestAllocator(NoHooksLU):
       ial = IAllocator(self.cfg, self.rpc,
                        mode=self.op.mode,
                        name=self.op.name,
-                       mem_size=self.op.mem_size,
+                       memory=self.op.memory,
                        disks=self.op.disks,
                        disk_template=self.op.disk_template,
                        os=self.op.os,
diff --git a/lib/opcodes.py b/lib/opcodes.py
index 6a5f3be..ce28539 100644
--- a/lib/opcodes.py
+++ b/lib/opcodes.py
@@ -1447,7 +1447,7 @@ class OpTestAllocator(OpCode):
     ("hypervisor", None, ht.TMaybeString, None),
     ("allocator", None, ht.TMaybeString, None),
     ("tags", ht.EmptyList, ht.TListOf(ht.TNonEmptyString), None),
-    ("mem_size", None, ht.TOr(ht.TNone, ht.TPositiveInt), None),
+    ("memory", None, ht.TOr(ht.TNone, ht.TPositiveInt), None),
     ("vcpus", None, ht.TOr(ht.TNone, ht.TPositiveInt), None),
     ("os", None, ht.TMaybeString, None),
     ("disk_template", None, ht.TMaybeString, None),
