Revision 9ade2eda lib/cmdlib.py

b/lib/cmdlib.py
2196 2196
  _OP_REQP = ["instances"]
2197 2197
  REQ_BGL = False
2198 2198

  
2199
  def ExpandNames(self):
2199
  def CheckArguments(self):
2200 2200
    if not isinstance(self.op.instances, list):
2201 2201
      raise errors.OpPrereqError("Invalid argument type 'instances'",
2202 2202
                                 errors.ECODE_INVAL)
2203 2203

  
2204
  def ExpandNames(self):
2204 2205
    if self.op.instances:
2205 2206
      self.wanted_names = []
2206 2207
      for name in self.op.instances:
......
2883 2884
  _FIELDS_DYNAMIC = utils.FieldSet("name", "valid", "node_status", "variants",
2884 2885
                                   "parameters", "api_versions")
2885 2886

  
2886
  def ExpandNames(self):
2887
  def CheckArguments(self):
2887 2888
    if self.op.names:
2888 2889
      raise errors.OpPrereqError("Selective OS query not supported",
2889 2890
                                 errors.ECODE_INVAL)
......
2892 2893
                       dynamic=self._FIELDS_DYNAMIC,
2893 2894
                       selected=self.op.output_fields)
2894 2895

  
2896
  def ExpandNames(self):
2895 2897
    # Lock all nodes, in shared mode
2896 2898
    # Temporary removal of locks, should be reverted later
2897 2899
    # TODO: reintroduce locks when they are lighter-weight
......
3116 3118
    "role"] + _SIMPLE_FIELDS
3117 3119
    )
3118 3120

  
3119
  def ExpandNames(self):
3121
  def CheckArguments(self):
3120 3122
    _CheckOutputFields(static=self._FIELDS_STATIC,
3121 3123
                       dynamic=self._FIELDS_DYNAMIC,
3122 3124
                       selected=self.op.output_fields)
3123 3125

  
3126
  def ExpandNames(self):
3124 3127
    self.needed_locks = {}
3125 3128
    self.share_locks[locking.LEVEL_NODE] = 1
3126 3129

  
......
3260 3263
  _FIELDS_DYNAMIC = utils.FieldSet("phys", "vg", "name", "size", "instance")
3261 3264
  _FIELDS_STATIC = utils.FieldSet("node")
3262 3265

  
3263
  def ExpandNames(self):
3266
  def CheckArguments(self):
3264 3267
    _CheckOutputFields(static=self._FIELDS_STATIC,
3265 3268
                       dynamic=self._FIELDS_DYNAMIC,
3266 3269
                       selected=self.op.output_fields)
3267 3270

  
3271
  def ExpandNames(self):
3268 3272
    self.needed_locks = {}
3269 3273
    self.share_locks[locking.LEVEL_NODE] = 1
3270 3274
    if not self.op.nodes:
......
3986 3990
  _FIELDS_STATIC = utils.FieldSet("cluster_name", "master_node", "drain_flag",
3987 3991
                                  "watcher_pause")
3988 3992

  
3989
  def ExpandNames(self):
3990
    self.needed_locks = {}
3991

  
3993
  def CheckArguments(self):
3992 3994
    _CheckOutputFields(static=self._FIELDS_STATIC,
3993 3995
                       dynamic=self._FIELDS_DYNAMIC,
3994 3996
                       selected=self.op.output_fields)
3995 3997

  
3998
  def ExpandNames(self):
3999
    self.needed_locks = {}
4000

  
3996 4001
  def CheckPrereq(self):
3997 4002
    """No prerequisites.
3998 4003

  
......
4435 4440
  _OP_DEFS = [("shutdown_timeout", constants.DEFAULT_SHUTDOWN_TIMEOUT)]
4436 4441
  REQ_BGL = False
4437 4442

  
4443
  def CheckArguments(self):
4444
    if self.op.reboot_type not in constants.REBOOT_TYPES:
4445
      raise errors.OpPrereqError("Invalid reboot type '%s', not one of %s" %
4446
                                  (self.op.reboot_type,
4447
                                   utils.CommaJoin(constants.REBOOT_TYPES)),
4448
                                 errors.ECODE_INVAL)
4449

  
4438 4450
  def ExpandNames(self):
4439
    if self.op.reboot_type not in [constants.INSTANCE_REBOOT_SOFT,
4440
                                   constants.INSTANCE_REBOOT_HARD,
4441
                                   constants.INSTANCE_REBOOT_FULL]:
4442
      raise errors.ParameterError("reboot type not in [%s, %s, %s]" %
4443
                                  (constants.INSTANCE_REBOOT_SOFT,
4444
                                   constants.INSTANCE_REBOOT_HARD,
4445
                                   constants.INSTANCE_REBOOT_FULL))
4446 4451
    self._ExpandAndLockInstance()
4447 4452

  
4448 4453
  def BuildHooksEnv(self):
......
4914 4919
  _FIELDS_DYNAMIC = utils.FieldSet("oper_state", "oper_ram", "status")
4915 4920

  
4916 4921

  
4917
  def ExpandNames(self):
4922
  def CheckArguments(self):
4918 4923
    _CheckOutputFields(static=self._FIELDS_STATIC,
4919 4924
                       dynamic=self._FIELDS_DYNAMIC,
4920 4925
                       selected=self.op.output_fields)
4921 4926

  
4927
  def ExpandNames(self):
4922 4928
    self.needed_locks = {}
4923 4929
    self.share_locks[locking.LEVEL_INSTANCE] = 1
4924 4930
    self.share_locks[locking.LEVEL_NODE] = 1
......
8283 8289
  _OP_REQP = ["instances", "static"]
8284 8290
  REQ_BGL = False
8285 8291

  
8286
  def ExpandNames(self):
8287
    self.needed_locks = {}
8288
    self.share_locks = dict.fromkeys(locking.LEVELS, 1)
8289

  
8292
  def CheckArguments(self):
8290 8293
    if not isinstance(self.op.instances, list):
8291 8294
      raise errors.OpPrereqError("Invalid argument type 'instances'",
8292 8295
                                 errors.ECODE_INVAL)
8293 8296

  
8297
  def ExpandNames(self):
8298
    self.needed_locks = {}
8299
    self.share_locks = dict.fromkeys(locking.LEVELS, 1)
8300

  
8294 8301
    if self.op.instances:
8295 8302
      self.wanted_names = []
8296 8303
      for name in self.op.instances:

Also available in: Unified diff