Revision 3494b9f6 lib/cmdlib.py

b/lib/cmdlib.py
1800 1800
          _ErrorIf(True, self.ENODERPC, node,
1801 1801
                   "node returned invalid LVM info, check LVM status")
1802 1802

  
1803
  def CheckPrereq(self):
1804
    """Check prerequisites.
1803
  def CheckArguments(self):
1804
    """Check arguments.
1805 1805

  
1806 1806
    Transform the list of checks we're going to skip into a set and check that
1807 1807
    all its members are valid.
......
3412 3412

  
3413 3413
    _CheckStorageType(self.op.storage_type)
3414 3414

  
3415
  def ExpandNames(self):
3416
    self.needed_locks = {
3417
      locking.LEVEL_NODE: self.op.node_name,
3418
      }
3419

  
3420
  def CheckPrereq(self):
3421
    """Check prerequisites.
3422

  
3423
    """
3424 3415
    storage_type = self.op.storage_type
3425 3416

  
3426 3417
    try:
......
3437 3428
                                 (storage_type, list(diff)),
3438 3429
                                 errors.ECODE_INVAL)
3439 3430

  
3431
  def ExpandNames(self):
3432
    self.needed_locks = {
3433
      locking.LEVEL_NODE: self.op.node_name,
3434
      }
3435

  
3440 3436
  def Exec(self, feedback_fn):
3441 3437
    """Computes the list of nodes and their attributes.
3442 3438

  
......
4288 4284
    ]
4289 4285
  REQ_BGL = False
4290 4286

  
4287
  def CheckArguments(self):
4288
    # extra beparams
4289
    if self.op.beparams:
4290
      if not isinstance(self.op.beparams, dict):
4291
        raise errors.OpPrereqError("Invalid beparams passed: %s, expected"
4292
                                   " dict" % (type(self.op.beparams), ),
4293
                                   errors.ECODE_INVAL)
4294
      # fill the beparams dict
4295
      utils.ForceDictType(self.op.beparams, constants.BES_PARAMETER_TYPES)
4296

  
4297
    if self.op.hvparams:
4298
      if not isinstance(self.op.hvparams, dict):
4299
        raise errors.OpPrereqError("Invalid hvparams passed: %s, expected"
4300
                                   " dict" % (type(self.op.hvparams), ),
4301
                                   errors.ECODE_INVAL)
4302

  
4291 4303
  def ExpandNames(self):
4292 4304
    self._ExpandAndLockInstance()
4293 4305

  
......
4314 4326
    assert self.instance is not None, \
4315 4327
      "Cannot retrieve locked instance %s" % self.op.instance_name
4316 4328

  
4317
    # extra beparams
4318
    if self.op.beparams:
4319
      if not isinstance(self.op.beparams, dict):
4320
        raise errors.OpPrereqError("Invalid beparams passed: %s, expected"
4321
                                   " dict" % (type(self.op.beparams), ),
4322
                                   errors.ECODE_INVAL)
4323
      # fill the beparams dict
4324
      utils.ForceDictType(self.op.beparams, constants.BES_PARAMETER_TYPES)
4325

  
4326 4329
    # extra hvparams
4327 4330
    if self.op.hvparams:
4328
      if not isinstance(self.op.hvparams, dict):
4329
        raise errors.OpPrereqError("Invalid hvparams passed: %s, expected"
4330
                                   " dict" % (type(self.op.hvparams), ),
4331
                                   errors.ECODE_INVAL)
4332

  
4333 4331
      # check hypervisor parameter syntax (locally)
4334 4332
      cluster = self.cfg.GetClusterInfo()
4335 4333
      utils.ForceDictType(self.op.hvparams, constants.HVS_PARAMETER_TYPES)
......
4706 4704
                                   (name_info.ip, new_name),
4707 4705
                                   errors.ECODE_NOTUNIQUE)
4708 4706

  
4709

  
4710 4707
  def Exec(self, feedback_fn):
4711 4708
    """Reinstall the instance.
4712 4709

  
......
7931 7928

  
7932 7929
    _CheckStorageType(self.op.storage_type)
7933 7930

  
7931
    storage_type = self.op.storage_type
7932

  
7933
    if (constants.SO_FIX_CONSISTENCY not in
7934
        constants.VALID_STORAGE_OPERATIONS.get(storage_type, [])):
7935
      raise errors.OpPrereqError("Storage units of type '%s' can not be"
7936
                                 " repaired" % storage_type,
7937
                                 errors.ECODE_INVAL)
7938

  
7934 7939
  def ExpandNames(self):
7935 7940
    self.needed_locks = {
7936 7941
      locking.LEVEL_NODE: [self.op.node_name],
......
7954 7959
    """Check prerequisites.
7955 7960

  
7956 7961
    """
7957
    storage_type = self.op.storage_type
7958

  
7959
    if (constants.SO_FIX_CONSISTENCY not in
7960
        constants.VALID_STORAGE_OPERATIONS.get(storage_type, [])):
7961
      raise errors.OpPrereqError("Storage units of type '%s' can not be"
7962
                                 " repaired" % storage_type,
7963
                                 errors.ECODE_INVAL)
7964

  
7965 7962
    # Check whether any instance on this node has faulty disks
7966 7963
    for inst in _GetNodeInstances(self.cfg, self.op.node_name):
7967 7964
      if not inst.admin_up:
......
8080 8077
    for node in nodenames:
8081 8078
      _CheckNodeOnline(self, node)
8082 8079

  
8083

  
8084 8080
    self.instance = instance
8085 8081

  
8086 8082
    if instance.disk_template not in constants.DTS_GROWABLE:

Also available in: Unified diff