func (mgr *pxeManagerT) checkAdditionalNICAddresses() {
	hosts := mgr.cluster.GetAllHosts()
	// sort the array so we have the host ordered by the internal IP
	// this will sort in a way how hosts are listed with mayuctl
	sort.SliceStable(hosts, func(i int, j int) bool {
		return hosts[i].InternalAddr.String() < hosts[j].InternalAddr.String()
	})
	for _, h := range hosts {
		// iterate over all extra NICs
		for i, nic := range mgr.config.Network.ExtraNICs {
			if h.AdditionalAddrs == nil {
				h.AdditionalAddrs = make(map[string]net.IP)
			}
			// check if the interface has already entry on the host config
			if ip, exists := h.AdditionalAddrs[nic.InterfaceName]; !exists {
				// no entry, lets add a new clean IP from the range
				h.AdditionalAddrs[nic.InterfaceName] = mgr.getNextAdditionalIP(i)
			} else {
				// host have assigned IP on this NIC, but we need to check if the network range matches
				ipStart := net.ParseIP(nic.IPRange.Start)
				ipEnd := net.ParseIP(nic.IPRange.End)
				if ipLessThanOrEqual(ipStart, ip) &&
					ipMoreThanOrEqual(ipEnd, ip) {
					// we should be good, IP is in the range of Start and End
					// DO nothing
				} else {
					// the ip is not in the range of Start and End
					// we need to clear this ip and assign a new one
					// this is tricky, this might not work as expected
					h.AdditionalAddrs[nic.InterfaceName] = mgr.getNextAdditionalIP(i)
				}
			}
		}
		_ = h.Save()
	}
}
// check af all hosts have properly assigned IP addresses to all Network.ExtraNICs entries
check af all hosts have properly assigned IP addresses to all Network.ExtraNICs entries
// check af all hosts have properly assigned IP addresses to all Network . ExtraNICs entries
func (mgr *pxeManagerT) checkAdditionalNICAddresses() {
	hosts := mgr.cluster.GetAllHosts()
	sort.SliceStable(hosts, func(i int, j int) bool {
		return hosts[i].InternalAddr.String() < hosts[j].InternalAddr.String()
	})
	for _, h := range hosts {
		for i, nic := range mgr.config.Network.ExtraNICs {
			if h.AdditionalAddrs == nil {
				h.AdditionalAddrs = make(map[string]net.IP)
			}
			if ip, exists := h.AdditionalAddrs[nic.InterfaceName]; !exists {
				h.AdditionalAddrs[nic.InterfaceName] = mgr.getNextAdditionalIP(i)
			} else {
				ipStart := net.ParseIP(nic.IPRange.Start)
				ipEnd := net.ParseIP(nic.IPRange.End)
				if ipLessThanOrEqual(ipStart, ip) &&
					ipMoreThanOrEqual(ipEnd, ip) {
				} else {
					h.AdditionalAddrs[nic.InterfaceName] = mgr.getNextAdditionalIP(i)
				}
			}
		}
		_ = h.Save()
	}
}
func ( mgr * pxeManagerT ) checkAdditionalNICAddresses ( ) { hosts := mgr . cluster . GetAllHosts ( ) sort . SliceStable ( hosts , func ( i int , j int ) bool { return hosts [ i ] . InternalAddr . String ( ) < hosts [ j ] . InternalAddr . String ( ) } ) for _ , h := range hosts { for i , nic := range mgr . config . Network . ExtraNICs { if h . AdditionalAddrs == nil { h . AdditionalAddrs = make ( map [ string ] net . IP ) } if ip , exists := h . AdditionalAddrs [ nic . InterfaceName ] ; ! exists { h . AdditionalAddrs [ nic . InterfaceName ] = mgr . getNextAdditionalIP ( i ) } else { ipStart := net . ParseIP ( nic . IPRange . Start ) ipEnd := net . ParseIP ( nic . IPRange . End ) if ipLessThanOrEqual ( ipStart , ip ) && ipMoreThanOrEqual ( ipEnd , ip ) { } else { h . AdditionalAddrs [ nic . InterfaceName ] = mgr . getNextAdditionalIP ( i ) } } } _ = h . Save ( ) } }
check af all hosts have properly assigned IP addresses to all Network.ExtraNICs entries
check af all hosts have properly assigned IP addresses to all Network . ExtraNICs entries
// sort the array so we have the host ordered by the internal IP // this will sort in a way how hosts are listed with mayuctl // iterate over all extra NICs // check if the interface has already entry on the host config // no entry, lets add a new clean IP from the range // host have assigned IP on this NIC, but we need to check if the network range matches // we should be good, IP is in the range of Start and End // DO nothing // the ip is not in the range of Start and End // we need to clear this ip and assign a new one // this is tricky, this might not work as expected