Commit 8901997e authored by Iustin Pop's avatar Iustin Pop
Browse files

A couple of small fixes to iallocator

This removes some constraints:
  - only two disks supported, this is no longer true as the underlying
    functions can now compute size for a variable number of disks
  - error when the hypervisor was not being passed
  - typo error

Reviewed-by: imsnah
parent 8d5b316c
......@@ -6472,8 +6472,6 @@ class IAllocator(object):
"""
data = self.in_data
if len(self.disks) != 2:
raise errors.OpExecError("Only two-disk configurations supported")
disk_space = _ComputeDiskSize(self.disk_template, self.disks)
......@@ -6630,8 +6628,6 @@ class LUTestAllocator(NoHooksLU):
" 'nics' parameter")
if not isinstance(self.op.disks, list):
raise errors.OpPrereqError("Invalid parameter 'disks'")
if len(self.op.disks) != 2:
raise errors.OpPrereqError("Only two-disk configurations supported")
for row in self.op.disks:
if (not isinstance(row, dict) or
"size" not in row or
......@@ -6640,7 +6636,7 @@ class LUTestAllocator(NoHooksLU):
row["mode"] not in ['r', 'w']):
raise errors.OpPrereqError("Invalid contents of the"
" 'disks' parameter")
if self.op.hypervisor is None:
if not hasattr(self.op, "hypervisor") or self.op.hypervisor is None:
self.op.hypervisor = self.cfg.GetHypervisorType()
elif self.op.mode == constants.IALLOCATOR_MODE_RELOC:
if not hasattr(self.op, "name"):
......
......@@ -156,7 +156,7 @@ commands = {
make_option("-m", "--mode", default="relocate",
choices=["relocate", "allocate"],
help="Request mode, either allocate or"
"relocate"),
" relocate"),
cli_option("--mem", default=128, type="unit",
help="Memory size for the instance (MiB)"),
make_option("--disks", default="4096,4096",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment