Revision c01a7953 lib/cmdlib/instance.py

b/lib/cmdlib/instance.py
834 834

  
835 835
    """
836 836
    self._CalculateFileStorageDir()
837
    ec_id = self.proc.GetECId()
837 838

  
838 839
    if self.op.mode == constants.INSTANCE_IMPORT:
839 840
      export_info = self._ReadExportInfo()
......
886 887
      self._RevertToDefaults(cluster)
887 888

  
888 889
    # NIC buildup
889
    self.nics = _ComputeNics(self.op, cluster, self.check_ip, self.cfg,
890
                             self.proc.GetECId())
890
    self.nics = _ComputeNics(self.op, cluster, self.check_ip, self.cfg, ec_id)
891 891

  
892 892
    # disk checks/pre-build
893 893
    default_vg = self.cfg.GetVGName()
......
932 932
    # creation job will fail.
933 933
    for nic in self.nics:
934 934
      if nic.mac in (constants.VALUE_AUTO, constants.VALUE_GENERATE):
935
        nic.mac = self.cfg.GenerateMAC(nic.network, self.proc.GetECId())
935
        nic.mac = self.cfg.GenerateMAC(nic.network, ec_id)
936 936

  
937 937
    #### allocator run
938 938

  
......
986 986
        if nic.ip is not None:
987 987
          if nic.ip.lower() == constants.NIC_IP_POOL:
988 988
            try:
989
              nic.ip = self.cfg.GenerateIp(net_uuid, self.proc.GetECId())
989
              nic.ip = self.cfg.GenerateIp(net_uuid, ec_id)
990 990
            except errors.ReservationError:
991 991
              raise errors.OpPrereqError("Unable to get a free IP for NIC %d"
992 992
                                         " from the address pool" % idx,
......
994 994
            self.LogInfo("Chose IP %s from network %s", nic.ip, nobj.name)
995 995
          else:
996 996
            try:
997
              self.cfg.ReserveIp(net_uuid, nic.ip, self.proc.GetECId())
997
              self.cfg.ReserveIp(net_uuid, nic.ip, ec_id)
998 998
            except errors.ReservationError:
999 999
              raise errors.OpPrereqError("IP address %s already in use"
1000 1000
                                         " or does not belong to network %s" %
......
2507 2507
        if new_ip.lower() == constants.NIC_IP_POOL:
2508 2508
          if new_net_uuid:
2509 2509
            try:
2510
              new_ip = self.cfg.GenerateIp(new_net_uuid, self.proc.GetECId())
2510
              new_ip = self.cfg.GenerateIp(new_net_uuid, ec_id)
2511 2511
            except errors.ReservationError:
2512 2512
              raise errors.OpPrereqError("Unable to get a free IP"
2513 2513
                                         " from the address pool",
2514 2514
                                         errors.ECODE_STATE)
2515 2515
            self.LogInfo("Chose IP %s from network %s",
2516
                         new_ip,
2517
                         new_net_obj.name)
2516
                         new_ip, new_net_obj.name)
2518 2517
            params[constants.INIC_IP] = new_ip
2519 2518
          else:
2520 2519
            raise errors.OpPrereqError("ip=pool, but no network found",
......
2522 2521
        # Reserve new IP if in the new network if any
2523 2522
        elif new_net_uuid:
2524 2523
          try:
2525
            self.cfg.ReserveIp(new_net_uuid, new_ip, self.proc.GetECId())
2524
            self.cfg.ReserveIp(new_net_uuid, new_ip, ec_id)
2526 2525
            self.LogInfo("Reserving IP %s in network %s",
2527 2526
                         new_ip, new_net_obj.name)
2528 2527
          except errors.ReservationError:
......
2536 2535
      # release old IP if old network is not None
2537 2536
      if old_ip and old_net_uuid:
2538 2537
        try:
2539
          self.cfg.ReleaseIp(old_net_uuid, old_ip, self.proc.GetECId())
2538
          self.cfg.ReleaseIp(old_net_uuid, old_ip, False, ec_id)
2540 2539
        except errors.AddressPoolError:
2541 2540
          logging.warning("Release IP %s not contained in network %s",
2542 2541
                          old_ip, old_net_obj.name)
......
2914 2913
      ip = params.ip
2915 2914
      net = params.network
2916 2915
      if net is not None and ip is not None:
2917
        self.cfg.ReleaseIp(net, ip, self.proc.GetECId())
2916
        self.cfg.ReleaseIp(net, ip, False, self.proc.GetECId())
2918 2917

  
2919 2918
    # Verify NIC changes (operating on copy)
2920 2919
    nics = instance.nics[:]

Also available in: Unified diff