Revision a0af6c80 lib/cmdlib.py

b/lib/cmdlib.py
10120 10120
    # creation job will fail.
10121 10121
    for nic in self.nics:
10122 10122
      if nic.mac in (constants.VALUE_AUTO, constants.VALUE_GENERATE):
10123
        nic.mac = self.cfg.GenerateMAC(self.proc.GetECId())
10123
        nic.mac = self.cfg.GenerateMAC(nic.network, self.proc.GetECId())
10124 10124

  
10125 10125
    #### allocator run
10126 10126

  
......
12846 12846
      elif mac in (constants.VALUE_AUTO, constants.VALUE_GENERATE):
12847 12847
        # otherwise generate the MAC address
12848 12848
        params[constants.INIC_MAC] = \
12849
          self.cfg.GenerateMAC(self.proc.GetECId())
12849
          self.cfg.GenerateMAC(new_net, self.proc.GetECId())
12850 12850
      else:
12851 12851
        # or validate/reserve the current one
12852 12852
        try:
......
12867 12867
      old_prefix = get_net_prefix(old_net)
12868 12868
      if old_prefix != new_prefix:
12869 12869
        params[constants.INIC_MAC] = \
12870
          self.cfg.GenerateMAC(self.proc.GetECId())
12870
          self.cfg.GenerateMAC(new_net, self.proc.GetECId())
12871 12871

  
12872 12872
    #if there is a change in nic-network configuration
12873 12873
    new_ip = params.get(constants.INIC_IP, old_ip)
......
15482 15482
      raise errors.OpPrereqError("Network '%s' already defined" %
15483 15483
                                 self.op.network, errors.ECODE_EXISTS)
15484 15484

  
15485
    if self.op.mac_prefix:
15486
      utils.NormalizeAndValidateMac(self.op.mac_prefix+":00:00:00")
15485 15487

  
15486 15488
  def BuildHooksEnv(self):
15487 15489
    """Build hooks env.
......
15670 15672
      if self.op.mac_prefix == constants.VALUE_NONE:
15671 15673
        self.mac_prefix = None
15672 15674
      else:
15675
        utils.NormalizeAndValidateMac(self.op.mac_prefix+":00:00:00")
15673 15676
        self.mac_prefix = self.op.mac_prefix
15674 15677

  
15675 15678
    if self.op.gateway6:

Also available in: Unified diff