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

OVS bonding and advanced OVS config support #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions manifests/l3/ifconfig.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
# [*bond_lacp_rate*]
# lacp MII rate
#
# [*bond_ifaces*]
# Array, or space-separated list of interfaces that should be on this
# bond interface. Only used if OVS enabled (global ::l23network::use_ovs
# or use_ovs_override are set to true.)
#
# [*ifname_order_prefix*]
# Sets the interface startup order
#
Expand Down Expand Up @@ -69,6 +74,17 @@
# [*check_by_ping_timeout*]
# Timeout for check_by_ping
#
# [*use_ovs_override*]
# Override the global ::l23network::use_ovs setting for this interface. (For
# Linux/OVS hybrid network setups, or situations where ::l23network::use_ovs
# is set by a higher level Puppet class.)
#
# [*ovs_extra*]
# Extra OVS configuration to be included in the interface file OVS_EXTRA.
#
# [*ovs_options*]
# Extra OVS configuration to be included in the interface file OVS_OPTIONS.
#
#
# If you configure 802.1q vlan interfaces then you must declare relationships
# between them in site.pp.
Expand All @@ -84,6 +100,7 @@
$bond_mode = undef,
$bond_miimon = 100,
$bond_lacp_rate = 1,
$bond_ifaces = undef,
$mtu = undef,
$dns_nameservers = undef,
$dns_search = undef,
Expand All @@ -93,6 +110,9 @@
$ifname_order_prefix = false,
$check_by_ping = 'gateway',
$check_by_ping_timeout = 120,
$use_ovs_override = undef,
$ovs_extra = undef,
$ovs_options = undef,
#todo: label => "XXX", # -- "ip addr add..... label XXX"
){
include ::l23network::params
Expand All @@ -107,6 +127,15 @@
'balance-alb'
]

# Determine if we're using OVS for this interface
$real_use_ovs = $use_ovs_override ? { undef => $::l23network::use_ovs, default => $use_ovs_override }

# Ignore bond slave interfaces if not using OVS
$real_bond_ifaces = $interface ? {
/^bond/ => $real_use_ovs ? { true => $bond_ifaces, default => undef },
default => undef
}

# setup configure method for inteface
if $bond_master {
$method = 'bondslave'
Expand Down Expand Up @@ -212,10 +241,10 @@
$vlan_dev = $1
}
/^(bond\d+)/: {
if ! $bond_mode {
if ! $real_use_ovs and ! $bond_mode {
fail("To configure the interface bonding you must the bond_mode parameter is required and must be between 0..6.")
}
if $bond_mode <0 or $bond_mode>6 {
if ! $real_use_ovs and ($bond_mode <0 or $bond_mode>6) {
fail("For interface bonding the bond_mode must be between 0..6, not '${bond_mode}'.")
}
$vlan_mode = undef
Expand Down
5 changes: 4 additions & 1 deletion templates/ipconfig_Debian_bondslave.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
auto <%= interface %>
iface <%= interface %> inet manual
bond-master <%= @bond_master %>
bond-master <%= @bond_master %>
<% if @ovs_extra %>ovs_extra <%= @ovs_extra %><% end %>
<% if @ovs_options %>ovs_options <%= @ovs_options %><% end %>

6 changes: 5 additions & 1 deletion templates/ipconfig_Debian_dhcp.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ iface <%= interface %> inet dhcp
bond-mode <%= @bond_mode %><% if @bond_miimon %>
bond-miimon <%= @bond_miimon %><% end %><% if @bond_lacp_rate %>
bond-lacp-rate <%= @bond_lacp_rate %><% end %>
<% end %>
<% end %>
<% if @real_bond_ifaces %>ovs_bonds <%= @real_bond_ifaces %><% end %>
<% if @ovs_extra %>ovs_extra <%= @ovs_extra %><% end %>
<% if @ovs_options %>ovs_options <%= @ovs_options %><% end %>

6 changes: 5 additions & 1 deletion templates/ipconfig_Debian_manual.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ down ip l set <%= interface %> down
bond-mode <%= @bond_mode %><% if @bond_miimon %>
bond-miimon <%= @bond_miimon %><% end %><% if @bond_lacp_rate %>
bond-lacp-rate <%= @bond_lacp_rate %><% end %>
<% end %>
<% end %>
<% if @real_bond_ifaces %>ovs_bonds <%= @real_bond_ifaces %><% end %>
<% if @ovs_extra %>ovs_extra <%= @ovs_extra %><% end %>
<% if @ovs_options %>ovs_options <%= @ovs_options %><% end %>

4 changes: 4 additions & 0 deletions templates/ipconfig_Debian_static.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ bond-mode <%= @bond_mode %><% if @bond_miimon %>
bond-miimon <%= @bond_miimon %><% end %><% if @bond_lacp_rate %>
bond-lacp-rate <%= @bond_lacp_rate %><% end %>
<% end %>
<% if @real_bond_ifaces %>ovs_bonds <%= @real_bond_ifaces %><% end %>
<%- if @ipaddr_aliases -%><%- @ipaddr_aliases.each do |addr| -%>
post-up ip addr add <%= addr %> dev <%= interface %>
pre-down ip addr del <%= addr %> dev <%= interface %>
<%- end -%><%- end -%>
<% if @ovs_extra %>ovs_extra <%= @ovs_extra %><% end %>
<% if @ovs_options %>ovs_options <%= @ovs_options %><% end %>

2 changes: 2 additions & 0 deletions templates/ipconfig_RedHat_bondslave.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ ONBOOT=yes
USERCTL=no
MASTER=<%= @bond_master %>
SLAVE=yes
<% if @ovs_extra %>OVS_EXTRA="<%= @ovs_extra %>"<% end %>
<% if @ovs_options %>OVS_OPTIONS="<%= @ovs_options %>"<% end %>
3 changes: 3 additions & 0 deletions templates/ipconfig_RedHat_dhcp.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ USERCTL=no
PHYSDEV=<%= @vlan_dev %><% end %>
<% if @mtu %>MTU=<%= @mtu %><% end %>
<% if @bond_mode %>BONDING_OPTS="mode=<%= @bond_mode %><% if @bond_miimon %> miimon=<%= @bond_miimon %><% end %><% if @bond_lacp_rate %> bond-lacp-rate=<%= @bond_lacp_rate %><% end %>"<% end %>
<% if @real_bond_ifaces %>BOND_IFACES="<%= @real_bond_ifaces %>"<% end %>
<% if @ovs_extra %>OVS_EXTRA="<%= @ovs_extra %>"<% end %>
<% if @ovs_options %>OVS_OPTIONS="<%= @ovs_options %>"<% end %>
4 changes: 4 additions & 0 deletions templates/ipconfig_RedHat_manual.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ USERCTL=no
PHYSDEV=<%= @vlan_dev %><% end %>
<% if @mtu %>MTU=<%= @mtu %><% end %>
<% if @bond_mode %>BONDING_OPTS="mode=<%= @bond_mode %><% if @bond_miimon %> miimon=<%= @bond_miimon %><% end %><% if @bond_lacp_rate %> bond-lacp-rate=<%= @bond_lacp_rate %><% end %>"<% end %>
<% if @real_bond_ifaces %>BOND_IFACES="<%= @real_bond_ifaces %>"<% end %>
<% if @ovs_extra %>OVS_EXTRA="<%= @ovs_extra %>"<% end %>
<% if @ovs_options %>OVS_OPTIONS="<%= @ovs_options %>"<% end %>

4 changes: 4 additions & 0 deletions templates/ipconfig_RedHat_static.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ PHYSDEV=<%= @vlan_dev %><% end %>
<% if @dns_search_string %>SEARCH=<%= @dns_search_string %><% end %>
<% if @mtu %>MTU=<%= @mtu %><% end %>
<% if @bond_mode %>BONDING_OPTS="mode=<%= @bond_mode %><% if @bond_miimon %> miimon=<%= @bond_miimon %><% end %><% if @bond_lacp_rate %> bond-lacp-rate=<%= @bond_lacp_rate %><% end %>"<% end %>
<% if @real_bond_ifaces %>BOND_IFACES="<%= @real_bond_ifaces %>"<% end %>
<% if @ovs_extra %>OVS_EXTRA="<%= @ovs_extra %>"<% end %>
<% if @ovs_options %>OVS_OPTIONS="<%= @ovs_options %>"<% end %>