Revision 43a8f36a lib/cmdlib.py

b/lib/cmdlib.py
1610 1610
  cluster-wide iallocator if appropriate.
1611 1611

  
1612 1612
  Check that at most one of (iallocator, node) is specified. If none is
1613
  specified, then the LU's opcode's iallocator slot is filled with the
1614
  cluster-wide default iallocator.
1613
  specified, or the iallocator is L{constants.DEFAULT_IALLOCATOR_SHORTCUT},
1614
  then the LU's opcode's iallocator slot is filled with the cluster-wide
1615
  default iallocator.
1615 1616

  
1616 1617
  @type iallocator_slot: string
1617 1618
  @param iallocator_slot: the name of the opcode iallocator slot
......
1621 1622
  """
1622 1623
  node = getattr(lu.op, node_slot, None)
1623 1624
  ialloc = getattr(lu.op, iallocator_slot, None)
1625
  if node == []:
1626
    node = None
1624 1627

  
1625 1628
  if node is not None and ialloc is not None:
1626 1629
    raise errors.OpPrereqError("Do not specify both, iallocator and node",
1627 1630
                               errors.ECODE_INVAL)
1628
  elif node is None and ialloc is None:
1631
  elif ((node is None and ialloc is None) or
1632
        ialloc == constants.DEFAULT_IALLOCATOR_SHORTCUT):
1629 1633
    default_iallocator = lu.cfg.GetDefaultIAllocator()
1630 1634
    if default_iallocator:
1631 1635
      setattr(lu.op, iallocator_slot, default_iallocator)
......
7137 7141
                                 " once: %s" % utils.CommaJoin(duplicates),
7138 7142
                                 errors.ECODE_INVAL)
7139 7143

  
7140
    if self.op.iallocator and self.op.nodes:
7141
      raise errors.OpPrereqError("Give either the iallocator or the new"
7142
                                 " nodes, not both", errors.ECODE_INVAL)
7144
    # We don't want _CheckIAllocatorOrNode selecting the default iallocator
7145
    # when neither iallocator nor nodes are specified
7146
    if self.op.iallocator or self.op.nodes:
7147
      _CheckIAllocatorOrNode(self, "iallocator", "nodes")
7143 7148

  
7144 7149
    for (idx, params) in self.op.disks:
7145 7150
      utils.ForceDictType(params, constants.IDISK_PARAMS_TYPES)

Also available in: Unified diff