Revision 10889e0c lib/cmdlib.py

b/lib/cmdlib.py
9394 9394
      # pylint: disable=W0142
9395 9395
      self.instance_file_storage_dir = utils.PathJoin(*joinargs)
9396 9396

  
9397
  def CheckPrereq(self):
9397
  def CheckPrereq(self): # pylint: disable=R0914
9398 9398
    """Check prerequisites.
9399 9399

  
9400 9400
    """
......
9631 9631

  
9632 9632
    nodenames = [pnode.name] + self.secondaries
9633 9633

  
9634
    # Verify instance specs
9635
    ispec = {
9636
      constants.ISPEC_MEM_SIZE: self.be_full.get(constants.BE_MAXMEM, None),
9637
      constants.ISPEC_CPU_COUNT: self.be_full.get(constants.BE_VCPUS, None),
9638
      constants.ISPEC_DISK_COUNT: len(self.disks),
9639
      constants.ISPEC_DISK_SIZE: [disk.size for disk in self.disks],
9640
      constants.ISPEC_NIC_COUNT: len(self.nics),
9641
      }
9642

  
9643
    ipolicy = _CalculateGroupIPolicy(cluster, pnode.group)
9644
    res = _ComputeIPolicyInstanceSpecViolation(ipolicy, ispec)
9645
    if not self.op.ignore_ipolicy and res:
9646
      raise errors.OpPrereqError(("Instance allocation to group %s violates"
9647
                                  " policy: %s") % (pnode.group,
9648
                                                    utils.CommaJoin(res)),
9649
                                  errors.ECODE_INVAL)
9650

  
9634 9651
    # disk parameters (not customizable at instance or node level)
9635 9652
    # just use the primary node parameters, ignoring the secondary.
9636 9653
    self.diskparams = self.cfg.GetNodeGroup(pnode.group).diskparams

Also available in: Unified diff