agent/eni/watcher/watcher_linux.go
func (udevWatcher *UdevWatcher) reconcileOnce() error {
	links, err := udevWatcher.netlinkClient.LinkList()
	if err != nil {
		return errors.Wrapf(err, "udev watcher: unable to retrieve network interfaces")
	}

	// Return on empty list
	if len(links) == 0 {
		log.Info("Udev watcher reconciliation: no network interfaces discovered for reconciliation")
		return nil
	}

	currentState := udevWatcher.buildState(links)

	// NOTE: For correct semantics, this entire function needs to be locked.
	// As we postulate the netlinkClient.LinkList() call to be expensive, we allow
	// the race here. The state would be corrected during the next reconciliation loop.

	// Add new interfaces next
	for mac := range currentState {
		if err := udevWatcher.sendENIStateChange(mac); err != nil {
			log.Warnf("Udev watcher reconciliation: unable to send state change: %v", err)
		}
	}
	return nil
}
func (udevWatcher *UdevWatcher) reconcileOnce() error {
	links, err := udevWatcher.netlinkClient.LinkList()
	if err != nil {
		return errors.Wrapf(err, "udev watcher: unable to retrieve network interfaces")
	}

	// Return on empty list
	if len(links) == 0 {
		log.Info("Udev watcher reconciliation: no network interfaces discovered for reconciliation")
		return nil
	}

	currentState := udevWatcher.buildState(links)

	// NOTE: For correct semantics, this entire function needs to be locked.
	// As we postulate the netlinkClient.LinkList() call to be expensive, we allow
	// the race here. The state would be corrected during the next reconciliation loop.

	// Add new interfaces next
	for mac := range currentState {
		if err := udevWatcher.sendENIStateChange(mac); err != nil {
			log.Warnf("Udev watcher reconciliation: unable to send state change: %v", err)
		}
	}
	return nil
}
func ( udevWatcher * UdevWatcher ) reconcileOnce ( ) error { links , err := udevWatcher . netlinkClient . LinkList ( ) if err != nil { return errors . Wrapf ( err , " " ) } // Return on empty list if len ( links ) == 0 { log . Info ( " " ) return nil } currentState := udevWatcher . buildState ( links ) // NOTE: For correct semantics, this entire function needs to be locked. // As we postulate the netlinkClient.LinkList() call to be expensive, we allow // the race here. The state would be corrected during the next reconciliation loop. // Add new interfaces next for mac := range currentState { if err := udevWatcher . sendENIStateChange ( mac ) ; err != nil { log . Warnf ( " " , err ) } } return nil }
// reconcileOnce is used to reconcile the state of ENIs attached to the instance
reconcileOnce is used to reconcile the state of ENIs attached to the instance