Revision 10889e0c

b/lib/cli.py
2309 2309
                                src_path=src_path,
2310 2310
                                tags=tags,
2311 2311
                                no_install=no_install,
2312
                                identify_defaults=identify_defaults)
2312
                                identify_defaults=identify_defaults,
2313
                                ignore_ipolicy=opts.ignore_ipolicy)
2313 2314

  
2314 2315
  SubmitOrSend(op, opts)
2315 2316
  return 0
b/lib/client/gnt_instance.py
1422 1422
  OS_OPT,
1423 1423
  FORCE_VARIANT_OPT,
1424 1424
  NO_INSTALL_OPT,
1425
  IGNORE_IPOLICY_OPT,
1425 1426
  ]
1426 1427

  
1427 1428
commands = {
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
b/lib/opcodes.py
1086 1086
    _PForceVariant,
1087 1087
    _PWaitForSync,
1088 1088
    _PNameCheck,
1089
    _PIgnoreIpolicy,
1089 1090
    ("beparams", ht.EmptyDict, ht.TDict, "Backend parameters for instance"),
1090 1091
    ("disks", ht.NoDefault,
1091 1092
     # TODO: Generate check from constants.IDISK_PARAMS_TYPES
b/man/gnt-instance.rst
39 39
| {{-n|--node} *node[:secondary-node]* \| {-I|--iallocator} *name*}
40 40
| {{-o|--os-type} *os-type*}
41 41
| [--submit]
42
| [--ignore-ipolicy]
42 43
| {*instance*}
43 44

  
44 45
Creates a new instance on the specified host. The *instance* argument
......
629 630
but not wait for its completion. The job ID will be shown so that it
630 631
can be examined via **gnt-job info**.
631 632

  
633
If ``--ignore-ipolicy`` is given any instance policy violations occuring
634
during this operation are ignored.
635

  
632 636
Example::
633 637

  
634 638
    # gnt-instance add -t file --disk 0:size=30g -B maxmem=512 -o debian-etch \

Also available in: Unified diff