Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

underlay: fix NetworkManager syncer for virtual interfaces #2988

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

zhangzujian
Copy link
Member

@zhangzujian zhangzujian commented Jun 27, 2023

What type of this PR

  • Bug fixes

Which issue(s) this PR fixes:

Virtual interfaces, such as bond/vlan, may be deleted and recreated by NetworkManager. A newly created virtual interface has a new DBus object path.

This patch fixes NetworkManager syncer for virtual interfaces by using the device name instead of the DBus object path.

WHAT

🤖 Generated by Copilot at a80f6b8

Refactored and optimized the networkManagerSyncer code in pkg/daemon/nm_linux.go to use IP interface names instead of dbus object paths. This simplifies the device identification and processing logic and improves the event handling and device management performance and reliability.

🤖 Generated by Copilot at a80f6b8

Sing, O Muse, of the skillful coder who simplified
The networkManagerSyncer code, and by his wisdom applied
The names of IP interfaces, not the paths of dbus objects
To identify and process devices, and avoid defects.

HOW

🤖 Generated by Copilot at a80f6b8

  • Simplify the networkManagerSyncer struct and its methods by using IP interface names instead of dbus object paths for the devices (link, link, link, link, link, link)
  • Modify the Run function to use strings.HasSuffix to check the event name and to filter out irrelevant devices from the workqueue (link, link)
  • Move the bridgeMap lookup outside the lock in the ProcessNextItem function to improve performance (link)

@zhangzujian zhangzujian added bug Something isn't working need backport labels Jun 27, 2023
@zhangzujian zhangzujian marked this pull request as ready for review June 27, 2023 06:19
@zhangzujian zhangzujian requested a review from oilbeater June 27, 2023 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need backport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants