Revision 4e0b4d2d

b/lib/cmdlib.py
2191 2191
  HPATH = "instance-reinstall"
2192 2192
  HTYPE = constants.HTYPE_INSTANCE
2193 2193
  _OP_REQP = ["instance_name"]
2194
  REQ_BGL = False
2195

  
2196
  def ExpandNames(self):
2197
    self._ExpandAndLockInstance()
2198
    self.needed_locks[locking.LEVEL_NODE] = []
2199
    self.recalculate_locks[locking.LEVEL_NODE] = 'replace'
2200

  
2201
  def DeclareLocks(self, level):
2202
    if level == locking.LEVEL_NODE:
2203
      self._LockInstancesNodes()
2194 2204

  
2195 2205
  def BuildHooksEnv(self):
2196 2206
    """Build hooks env.
......
2209 2219
    This checks that the instance is in the cluster and is not running.
2210 2220

  
2211 2221
    """
2212
    instance = self.cfg.GetInstanceInfo(
2213
      self.cfg.ExpandInstanceName(self.op.instance_name))
2214
    if instance is None:
2215
      raise errors.OpPrereqError("Instance '%s' not known" %
2216
                                 self.op.instance_name)
2222
    instance = self.cfg.GetInstanceInfo(self.op.instance_name)
2223
    assert instance is not None, \
2224
      "Cannot retrieve locked instance %s" % self.op.instance_name
2225

  
2217 2226
    if instance.disk_template == constants.DT_DISKLESS:
2218 2227
      raise errors.OpPrereqError("Instance '%s' has no disks" %
2219 2228
                                 self.op.instance_name)

Also available in: Unified diff