Revision 8cc7e742 lib/cmdlib.py

b/lib/cmdlib.py
3509 3509
                     mem_size=self.be_full[constants.BE_MEMORY],
3510 3510
                     disks=self.disks,
3511 3511
                     nics=nics,
3512
                     hypervisor=self.op.hypervisor,
3512 3513
                     )
3513 3514

  
3514 3515
    ial.Run(self.op.iallocator)
......
5309 5310
  """
5310 5311
  _ALLO_KEYS = [
5311 5312
    "mem_size", "disks", "disk_template",
5312
    "os", "tags", "nics", "vcpus",
5313
    "os", "tags", "nics", "vcpus", "hypervisor",
5313 5314
    ]
5314 5315
  _RELO_KEYS = [
5315 5316
    "relocate_from",
......
5369 5370
    # node data
5370 5371
    node_results = {}
5371 5372
    node_list = cfg.GetNodeList()
5372
    # FIXME: here we have only one hypervisor information, but
5373
    # instance can belong to different hypervisors
5373

  
5374
    if self.mode == constants.IALLOCATOR_MODE_ALLOC:
5375
      hypervisor = self.hypervisor
5376
    elif self.mode == constants.IALLOCATOR_MODE_RELOC:
5377
      hypervisor = cfg.GetInstanceInfo(self.name).hypervisor
5378

  
5374 5379
    node_data = self.lu.rpc.call_node_info(node_list, cfg.GetVGName(),
5375
                                           cfg.GetHypervisorType())
5380
                                           hypervisor)
5376 5381
    for nname in node_list:
5377 5382
      ninfo = cfg.GetNodeInfo(nname)
5378 5383
      if nname not in node_data or not isinstance(node_data[nname], dict):
......
5614 5619
            row["mode"] not in ['r', 'w']):
5615 5620
          raise errors.OpPrereqError("Invalid contents of the"
5616 5621
                                     " 'disks' parameter")
5622
      if self.op.hypervisor is None:
5623
        self.op.hypervisor = self.cfg.GetHypervisorType()
5617 5624
    elif self.op.mode == constants.IALLOCATOR_MODE_RELOC:
5618 5625
      if not hasattr(self.op, "name"):
5619 5626
        raise errors.OpPrereqError("Missing attribute 'name' on opcode input")
......
5649 5656
                       tags=self.op.tags,
5650 5657
                       nics=self.op.nics,
5651 5658
                       vcpus=self.op.vcpus,
5659
                       hypervisor=self.op.hypervisor,
5652 5660
                       )
5653 5661
    else:
5654 5662
      ial = IAllocator(self,

Also available in: Unified diff