Skip to content

check ovn0 mac should be set expected#5748

Merged
changluyi merged 1 commit intomasterfrom
check_ovn0_mac_should_be_set_expected
Sep 23, 2025
Merged

check ovn0 mac should be set expected#5748
changluyi merged 1 commit intomasterfrom
check_ovn0_mac_should_be_set_expected

Conversation

@changluyi
Copy link
Copy Markdown
Collaborator

@changluyi changluyi commented Sep 23, 2025

Pull Request

What type of this PR

Examples of user facing changes:

  • Features
  • Bug fixes
    There's a chance that the MAC address of the ovn0 network interface card (NIC) may differ from the MAC address assigned to it by kube-ovn-controller. To check if the MAC address is incorrect, restart kube-ovn-cni.
  • Docs
  • Tests

Which issue(s) this PR fixes

Fixes #(issue-number)

Signed-off-by: clyi <clyi@alauda.io>
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Sep 23, 2025
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @changluyi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of the OVN daemon's network configuration by adding a crucial validation step. It ensures that the ovn0 interface's MAC address is correctly set as anticipated before allowing the configuration process to continue. This change aims to proactively identify and report any discrepancies in MAC address assignments, thereby improving network stability and debugging capabilities.

Highlights

  • MAC Address Validation: A new validation step has been introduced to explicitly check the MAC address of the ovn0 interface against its expected value during node network configuration.
  • Error Handling for Mismatch: The system will now return an error and log a critical message if a mismatch is detected between the actual and expected MAC addresses for ovn0, preventing further configuration with an incorrect MAC.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot bot added bug Something isn't working go Pull requests that update Go code labels Sep 23, 2025
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a check to verify that the MAC address of the ovn0 interface is set as expected. However, there's a logical issue in the error handling for a MAC address mismatch that results in a misleading error message. My review includes a suggestion to correct this.

Comment on lines +673 to +678
if actualMac.String() != macAddr.String() {
macAddr = actualMac
err := fmt.Errorf("MAC address mismatch on %s: expected %s, actual %s", util.NodeNic, macAddr.String(), actualMac.String())
klog.Error(err)
return err
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error message for the MAC address mismatch is incorrect because the macAddr variable is reassigned before the error string is formatted. This results in the 'expected' and 'actual' MAC addresses in the log message being identical, which is misleading and hinders debugging. The reassignment of macAddr is also unnecessary as the function returns immediately after.

	if actualMac.String() != macAddr.String() {
		err := fmt.Errorf("MAC address mismatch on %s: expected %s, actual %s", util.NodeNic, macAddr.String(), actualMac.String())
		klog.Error(err)
		return err
	}

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 23, 2025
@changluyi changluyi merged commit d632945 into master Sep 23, 2025
71 checks passed
@changluyi changluyi deleted the check_ovn0_mac_should_be_set_expected branch September 23, 2025 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update Go code lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants