Revision b4364a6b

b/lib/cmdlib.py
3610 3610

  
3611 3611
      self.src_images = disk_images
3612 3612

  
3613
      if self.op.mac == constants.VALUE_AUTO:
3614
        old_name = export_info.get(constants.INISECT_INS, 'name')
3615
        if self.op.instance_name == old_name:
3616
          # FIXME: adjust every nic, when we'll be able to create instances
3617
          # with more than one
3618
          if int(export_info.get(constants.INISECT_INS, 'nic_count')) >= 1:
3619
            self.op.mac = export_info.get(constants.INISECT_INS, 'nic_0_mac')
3613
      old_name = export_info.get(constants.INISECT_INS, 'name')
3614
      # FIXME: int() here could throw a ValueError on broken exports
3615
      exp_nic_count = int(export_info.get(constants.INISECT_INS, 'nic_count'))
3616
      if self.op.instance_name == old_name:
3617
        for idx, nic in enumerate(self.nics):
3618
          if nic.mac == constants.VALUE_AUTO and exp_nic_count >= idx:
3619
            nic_mac_ini = 'nic%d_mac' % idx
3620
            nic.mac = export_info.get(constants.INISECT_INS, nic_mac_ini)
3620 3621

  
3621 3622
    # ip ping checks (we use the same ip that was resolved in ExpandNames)
3622

  
3623 3623
    if self.op.start and not self.op.ip_check:
3624 3624
      raise errors.OpPrereqError("Cannot ignore IP address conflicts when"
3625 3625
                                 " adding an instance in start mode")

Also available in: Unified diff