Revision bd061c35

b/lib/cmdlib.py
6116 6116
      # TODO: make the ip check more flexible and not depend on the name check
6117 6117
      raise errors.OpPrereqError("Cannot do ip checks without a name check",
6118 6118
                                 errors.ECODE_INVAL)
6119
    # check disk information: either all adopt, or no adopt
6119

  
6120
    # check nics' parameter names
6121
    for nic in self.op.nics:
6122
      utils.ForceDictType(nic, constants.INIC_PARAMS_TYPES)
6123

  
6124
    # check disks. parameter names and consistent adopt/no-adopt strategy
6120 6125
    has_adopt = has_no_adopt = False
6121 6126
    for disk in self.op.disks:
6127
      utils.ForceDictType(disk, constants.IDISK_PARAMS_TYPES)
6122 6128
      if "adopt" in disk:
6123 6129
        has_adopt = True
6124 6130
      else:
......
8170 8176
    # Disk validation
8171 8177
    disk_addremove = 0
8172 8178
    for disk_op, disk_dict in self.op.disks:
8179
      utils.ForceDictType(disk_dict, constants.IDISK_PARAMS_TYPES)
8173 8180
      if disk_op == constants.DDM_REMOVE:
8174 8181
        disk_addremove += 1
8175 8182
        continue
......
8223 8230
    # NIC validation
8224 8231
    nic_addremove = 0
8225 8232
    for nic_op, nic_dict in self.op.nics:
8233
      utils.ForceDictType(nic_dict, constants.INIC_PARAMS_TYPES)
8226 8234
      if nic_op == constants.DDM_REMOVE:
8227 8235
        nic_addremove += 1
8228 8236
        continue
b/lib/constants.py
512 512

  
513 513
NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
514 514

  
515
IDISK_SIZE = "size"
516
IDISK_MODE = "mode"
517
IDISK_PARAMS = frozenset([IDISK_SIZE, IDISK_MODE])
518
IDISK_PARAMS_TYPES = {IDISK_SIZE: VTYPE_SIZE, IDISK_MODE: VTYPE_STRING}
519
INIC_MAC = "mac"
520
INIC_IP = "ip"
521
INIC_MODE = "mode"
522
INIC_LINK = "link"
523
INIC_BRIDGE = "bridge"
524
INIC_PARAMS = frozenset([INIC_MAC, INIC_IP, INIC_MODE, INIC_LINK, INIC_BRIDGE])
525
INIC_PARAMS_TYPES = dict([(name, VTYPE_STRING) for name in INIC_PARAMS])
526

  
515 527
# Hypervisor constants
516 528
HT_XEN_PVM = "xen-pvm"
517 529
HT_FAKE = "fake"

Also available in: Unified diff