Revision e58009da lib/cmdlib.py

b/lib/cmdlib.py
9492 9492
                                       hypervisor=op.hypervisor)
9493 9493

  
9494 9494

  
9495
def _ComputeNics(op, cluster, default_ip, cfg, proc):
9495
def _ComputeNics(op, cluster, default_ip, cfg, ec_id):
9496 9496
  """Computes the nics.
9497 9497

  
9498 9498
  @param op: The instance opcode
9499 9499
  @param cluster: Cluster configuration object
9500 9500
  @param default_ip: The default ip to assign
9501 9501
  @param cfg: An instance of the configuration object
9502
  @param proc: The executer instance
9502
  @param ec_id: Execution context ID
9503 9503

  
9504 9504
  @returns: The build up nics
9505 9505

  
......
9559 9559

  
9560 9560
      try:
9561 9561
        # TODO: We need to factor this out
9562
        cfg.ReserveMAC(mac, proc.GetECId())
9562
        cfg.ReserveMAC(mac, ec_id)
9563 9563
      except errors.ReservationError:
9564 9564
        raise errors.OpPrereqError("MAC address %s already in use"
9565 9565
                                   " in cluster" % mac,
......
10174 10174

  
10175 10175
    # NIC buildup
10176 10176
    self.nics = _ComputeNics(self.op, cluster, self.hostname1.ip, self.cfg,
10177
                             self.proc)
10177
                             self.proc.GetECId())
10178 10178

  
10179 10179
    # disk checks/pre-build
10180 10180
    default_vg = self.cfg.GetVGName()
......
10760 10760
    """
10761 10761
    cluster = self.cfg.GetClusterInfo()
10762 10762
    default_vg = self.cfg.GetVGName()
10763
    ec_id = self.proc.GetECId()
10764

  
10763 10765
    insts = [_CreateInstanceAllocRequest(op, _ComputeDisks(op, default_vg),
10764 10766
                                         _ComputeNics(op, cluster, None,
10765
                                                      self.cfg, self.proc),
10767
                                                      self.cfg, ec_id),
10766 10768
                                         _ComputeFullBeParams(op, cluster))
10767 10769
             for op in self.op.instances]
10770

  
10768 10771
    req = iallocator.IAReqMultiInstanceAlloc(instances=insts)
10769 10772
    ial = iallocator.IAllocator(self.cfg, self.rpc, req)
10770 10773

  

Also available in: Unified diff