-
Notifications
You must be signed in to change notification settings - Fork 59
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
network: set max mtu of a parent to the max of its children #1371
Conversation
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.
There is still @vuntz comment regarding a possible optimization: #1228 (comment)
But, I'd suggest to address that in a follow up PR to get this one finally merged.
@nicolasbock could you re-review? I had to correct a rebase error since your first review |
|
||
unless all_children.empty? | ||
max_mtu_nic = all_children.max_by { |k, v| v["mtu"] }[0] | ||
ifs[nic.parent]["mtu"] = ifs[max_mtu_nic]["mtu"] |
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.
There was some .to_i
in the initial PR. It's not strictly required, I guess, though.
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.
Hmm, you're right that it was there. I removed it because it there before the change and because it's an assignment, not a comparison, so it doesn't matter that much. I'll add it back though.
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.
done
Ha, you got me |
iterate over all the children to obtain the max mtu that we need to set to a parent nic. Before this, only the first vlan children of a parent was used to set an mtu value, failing afterwards if the next vlan had a bigger value.
Navin found during testing that some configurations could lead to the var all_children being empty and that would break the chef run. This introduces a guard against that.
🤣 |
What about the missing uppercase? ;-) |
(originally at #1228, description copied)
iterate over all the children to obtain the max mtu that we need to
set to a parent nic. Before this, only the first vlan children of a parent
was used to set an mtu value, failing afterwards if the next vlan had a bigger
value.
Introduced in #1084