-
Notifications
You must be signed in to change notification settings - Fork 261
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
🐛 Fix looking for existing node by MAC #2088
base: main
Are you sure you want to change the base?
Conversation
Hi @hex2dec. Thanks for your PR. I'm waiting for a metal3-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know this area well enough to review.
/cc @dtantsur
/cc @elfosardo @zaneb |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Add null check for bootMACAddress to prevent unnecessary port listing when finding an existing Ironic node. Signed-off-by: Zhiwei Huang <[email protected]>
p.log.Info("looking for existing node by MAC", "MAC", bootMACAddress) | ||
allPorts, err := p.listAllPorts(bootMACAddress) | ||
// If mac address is present in host config, try to load the node by this port with mac address. | ||
if bootMACAddress != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: an early return here would be easier to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a good coding tip 😃 . From the findExistingHost
function, it supports multiple methods to find an existing node, and other methods may be added in the future, the early return is not very good at showing the order in which all methods were tried. Therefore, it is recommended to use the method to find an node by port only when the value of bootMACAddress is present.
What this PR does / why we need it:
Fix listing ironic node's ports with empty mac address. Call the listing ports API with empty mac address is same as listing all ironic node ports.