Revision 24ea7a54 lib/cmdlib.py

b/lib/cmdlib.py
9877 9877
    # creation job will fail.
9878 9878
    for nic in self.nics:
9879 9879
      if nic.mac in (constants.VALUE_AUTO, constants.VALUE_GENERATE):
9880
        nic.mac = self.cfg.GenerateMAC(self.proc.GetECId())
9880
        nic.mac = self.cfg.GenerateMAC(nic.network, self.proc.GetECId())
9881 9881

  
9882 9882
    #### allocator run
9883 9883

  
......
12412 12412
      elif mac in (constants.VALUE_AUTO, constants.VALUE_GENERATE):
12413 12413
        # otherwise generate the MAC address
12414 12414
        params[constants.INIC_MAC] = \
12415
          self.cfg.GenerateMAC(self.proc.GetECId())
12415
          self.cfg.GenerateMAC(new_net, self.proc.GetECId())
12416 12416
      else:
12417 12417
        # or validate/reserve the current one
12418 12418
        try:
......
12433 12433
      old_prefix = get_net_prefix(old_net)
12434 12434
      if old_prefix != new_prefix:
12435 12435
        params[constants.INIC_MAC] = \
12436
          self.cfg.GenerateMAC(self.proc.GetECId())
12436
          self.cfg.GenerateMAC(new_net, self.proc.GetECId())
12437 12437

  
12438 12438
    #if there is a change in nic-network configuration
12439 12439
    new_ip = params.get(constants.INIC_IP, old_ip)
......
15507 15507
      raise errors.OpPrereqError("Network '%s' already defined" %
15508 15508
                                 self.op.network, errors.ECODE_EXISTS)
15509 15509

  
15510
    if self.op.mac_prefix:
15511
      utils.NormalizeAndValidateMac(self.op.mac_prefix+":00:00:00")
15510 15512

  
15511 15513
  def BuildHooksEnv(self):
15512 15514
    """Build hooks env.
......
15695 15697
      if self.op.mac_prefix == constants.VALUE_NONE:
15696 15698
        self.mac_prefix = None
15697 15699
      else:
15700
        utils.NormalizeAndValidateMac(self.op.mac_prefix+":00:00:00")
15698 15701
        self.mac_prefix = self.op.mac_prefix
15699 15702

  
15700 15703
    if self.op.gateway6:

Also available in: Unified diff