diff --git a/manifests/l3/ifconfig.pp b/manifests/l3/ifconfig.pp index b78ee1b..372907e 100644 --- a/manifests/l3/ifconfig.pp +++ b/manifests/l3/ifconfig.pp @@ -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 # @@ -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. @@ -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, @@ -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 @@ -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' @@ -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 diff --git a/templates/ipconfig_Debian_bondslave.erb b/templates/ipconfig_Debian_bondslave.erb index ed02a4e..f4a52a2 100644 --- a/templates/ipconfig_Debian_bondslave.erb +++ b/templates/ipconfig_Debian_bondslave.erb @@ -1,3 +1,6 @@ auto <%= interface %> iface <%= interface %> inet manual -bond-master <%= @bond_master %> \ No newline at end of file +bond-master <%= @bond_master %> +<% if @ovs_extra %>ovs_extra <%= @ovs_extra %><% end %> +<% if @ovs_options %>ovs_options <%= @ovs_options %><% end %> + diff --git a/templates/ipconfig_Debian_dhcp.erb b/templates/ipconfig_Debian_dhcp.erb index eb53a83..a37c8d8 100644 --- a/templates/ipconfig_Debian_dhcp.erb +++ b/templates/ipconfig_Debian_dhcp.erb @@ -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 %> \ No newline at end of file +<% 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 %> + diff --git a/templates/ipconfig_Debian_manual.erb b/templates/ipconfig_Debian_manual.erb index 856f41d..7d751e6 100644 --- a/templates/ipconfig_Debian_manual.erb +++ b/templates/ipconfig_Debian_manual.erb @@ -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 %> \ No newline at end of file +<% 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 %> + diff --git a/templates/ipconfig_Debian_static.erb b/templates/ipconfig_Debian_static.erb index 2b09637..096ef15 100644 --- a/templates/ipconfig_Debian_static.erb +++ b/templates/ipconfig_Debian_static.erb @@ -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 %> + diff --git a/templates/ipconfig_RedHat_bondslave.erb b/templates/ipconfig_RedHat_bondslave.erb index e511ba7..dd27d6c 100644 --- a/templates/ipconfig_RedHat_bondslave.erb +++ b/templates/ipconfig_RedHat_bondslave.erb @@ -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 %> diff --git a/templates/ipconfig_RedHat_dhcp.erb b/templates/ipconfig_RedHat_dhcp.erb index 832416b..8ddfbf8 100644 --- a/templates/ipconfig_RedHat_dhcp.erb +++ b/templates/ipconfig_RedHat_dhcp.erb @@ -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 %> diff --git a/templates/ipconfig_RedHat_manual.erb b/templates/ipconfig_RedHat_manual.erb index 40e061a..ad49775 100644 --- a/templates/ipconfig_RedHat_manual.erb +++ b/templates/ipconfig_RedHat_manual.erb @@ -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 %> + diff --git a/templates/ipconfig_RedHat_static.erb b/templates/ipconfig_RedHat_static.erb index d1e6b49..4681254 100644 --- a/templates/ipconfig_RedHat_static.erb +++ b/templates/ipconfig_RedHat_static.erb @@ -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 %> +