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

[3.0] network: Set MTU for VLAN parent interface (bsc#1024279) #1241

Merged
merged 1 commit into from
Jul 10, 2017
Merged

[3.0] network: Set MTU for VLAN parent interface (bsc#1024279) #1241

merged 1 commit into from
Jul 10, 2017

Conversation

Itxaka
Copy link
Member

@Itxaka Itxaka commented Jun 5, 2017

If a physical interface has VLAN(s) configured with a custom MTU set but
the underlying physical network is not used directly and has no MTU in
its config, use the MTU from the VLAN interface for the parent device.
If there are multiple VLANs, use the highest MTU for the parent.

Also, if the physical parent from a VLAN interface is configured but the
MTU is lower than one of its VLAN interfaces, abort the chef-client run
and raise a useful error message.

(cherry picked from commit fc4152d)

Backported as requested on #1230 by @vuntz

If a physical interface has VLAN(s) configured with a custom MTU set but
the underlying physical network is not used directly and has no MTU in
its config, use the MTU from the VLAN interface for the parent device.
If there are multiple VLANs, use the highest MTU for the parent.

Also, if the physical parent from a VLAN interface is configured but the
MTU is lower than one of its VLAN interfaces, abort the chef-client run
and raise a useful error message.

(cherry picked from commit fc4152d)
parent_nic = Nic.new(nic.parent)
Chef::Log.info("vlan #{nic.name} wants mtu #{ifs[nic.name]["mtu"]} but " \
"parent #{parent_nic.name} wants no/lower mtu. Set mtu "\
"for #{parent_nic.name} to #{ifs[nic.parent]['mtu']}")

Choose a reason for hiding this comment

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

Style/StringLiteralsInInterpolation: Prefer double-quoted strings inside interpolations. (https://github.com/SUSE/style-guides/blob/master/Ruby.md#stylestringliteralsininterpolation)

end
end
# 2) set the mtu for the parent if needed
if !ifs[nic.parent].key? "mtu" || (ifs[nic.parent]["mtu"].to_i < ifs[nic.name]["mtu"].to_i)

Choose a reason for hiding this comment

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

Style/NegatedIf: Favor unless over if for negative conditions. (https://github.com/bbatsov/ruby-style-guide#unless-for-negatives)
Lint/RequireParentheses: Use parentheses in the method call to avoid confusion about precedence.

networks_using_parent = if_mapping.select { |net, ifaces| ifaces.include? nic.parent }.keys
networks_using_parent.each do |net_name|
net = Barclamp::Inventory.get_network_by_type(node, net_name)
unless net.use_vlan

Choose a reason for hiding this comment

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

Style/Next: Use next to skip iteration. (https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals)

@Itxaka
Copy link
Member Author

Itxaka commented Jun 5, 2017

@vuntz
Copy link
Member

vuntz commented Jun 28, 2017

@Itxaka mkcloud failed here, I guess this should be triggered again.

@Itxaka Itxaka merged commit 9819028 into crowbar:stable/3.0 Jul 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants