Revision da4a52a3 lib/masterd/iallocator.py

b/lib/masterd/iallocator.py
58 58
                        ht.TItems([_NEVAC_MOVED, _NEVAC_FAILED, _JOB_LIST]))
59 59

  
60 60
_INST_NAME = ("name", ht.TNonEmptyString)
61
_INST_UUID = ("inst_uuid", ht.TNonEmptyString)
61 62

  
62 63

  
63 64
class _AutoReqParam(outils.AutoSlots):
......
233 234
  # pylint: disable=E1101
234 235
  MODE = constants.IALLOCATOR_MODE_RELOC
235 236
  REQ_PARAMS = [
236
    _INST_NAME,
237
    _INST_UUID,
237 238
    ("relocate_from_node_uuids", _STRING_LIST),
238 239
    ]
239 240
  REQ_RESULT = ht.TList
......
245 246
    done.
246 247

  
247 248
    """
248
    instance = cfg.GetInstanceInfo(self.name)
249
    instance = cfg.GetInstanceInfo(self.inst_uuid)
249 250
    if instance is None:
250 251
      raise errors.ProgrammerError("Unknown instance '%s' passed to"
251
                                   " IAllocator" % self.name)
252
                                   " IAllocator" % self.inst_uuid)
252 253

  
253 254
    if instance.disk_template not in constants.DTS_MIRRORED:
254 255
      raise errors.OpPrereqError("Can't relocate non-mirrored instances",
......
263 264
    disk_space = gmi.ComputeDiskSize(instance.disk_template, disk_sizes)
264 265

  
265 266
    return {
266
      "name": self.name,
267
      "name": instance.name,
267 268
      "disk_space_total": disk_space,
268 269
      "required_nodes": 1,
269 270
      "relocate_from": cfg.GetNodeNames(self.relocate_from_node_uuids),
......
281 282
    fn = compat.partial(self._NodesToGroups, node2group,
282 283
                        ia.in_data["nodegroups"])
283 284

  
284
    instance = ia.cfg.GetInstanceInfo(self.name)
285
    instance = ia.cfg.GetInstanceInfo(self.inst_uuid)
285 286
    request_groups = fn(ia.cfg.GetNodeNames(self.relocate_from_node_uuids) +
286 287
                        ia.cfg.GetNodeNames([instance.primary_node]))
287 288
    result_groups = fn(result + ia.cfg.GetNodeNames([instance.primary_node]))
......
424 425
      hypervisor_name = self.req.hypervisor
425 426
      node_whitelist = self.req.node_whitelist
426 427
    elif isinstance(self.req, IAReqRelocate):
427
      hypervisor_name = self.cfg.GetInstanceInfo(self.req.name).hypervisor
428
      hypervisor_name = self.cfg.GetInstanceInfo(self.req.inst_uuid).hypervisor
428 429
      node_whitelist = None
429 430
    else:
430 431
      hypervisor_name = cluster_info.primary_hypervisor

Also available in: Unified diff