add some minor fixes to the L23 module.

Closes-Bug: #1310655
Change-Id: Ic8fd53e3040577e0ea466767690ce72a39fb45fa
This commit is contained in:
Sergey Vasilenko 2014-04-21 16:14:57 +04:00 committed by Gerrit Code Review
parent 28d82c7960
commit 8b68888bd5
13 changed files with 29 additions and 16 deletions

View File

@ -203,6 +203,12 @@ Puppet::Parser::Functions::newfunction(:generate_network_config, :type => :rvalu
ifconfig_order.insert(-1, t[:name].to_sym()) ifconfig_order.insert(-1, t[:name].to_sym())
end end
elsif action == :bond elsif action == :bond
if ! t[:interfaces].is_a? Array
raise(Puppet::ParseError, "generate_network_config(): 'add-bond' resource should has non-empty 'interfaces' list.")
end
if ! t[:properties].is_a? Hash
raise(Puppet::ParseError, "generate_network_config(): 'add-bond' resource should has non-empty 'properties' field.")
end
if t[:provider] == 'lnx' if t[:provider] == 'lnx'
if ! ifconfig_order.index(t[:name].to_sym()) if ! ifconfig_order.index(t[:name].to_sym())
ifconfig_order.insert(-1, t[:name].to_sym()) ifconfig_order.insert(-1, t[:name].to_sym())

View File

@ -28,13 +28,15 @@ EOS
# Add deprecated properties # Add deprecated properties
depre.each { |k,v| depre.each { |k,v|
if rv[k].nil? if rv[k].nil? and ![nil, 'undef', :undef].index(v)
warn("You using deprecated parameter '#{k}':#{v}")
rv[k] = v rv[k] = v
end end
} }
defa.each { |k,v| defa.each { |k,v|
if rv[k].nil? if rv[k].nil? and ![nil, 'undef', :undef].index(v)
info("Setup default parameter '#{k}':#{v}")
rv[k] = v rv[k] = v
end end
} }

View File

@ -32,6 +32,7 @@ define l23network::l2::bond (
$properties = [], $properties = [],
$tag = 0, $tag = 0,
$trunks = [], $trunks = [],
$provider = 'ovs',
$ensure = present, $ensure = present,
$skip_existing = false $skip_existing = false
) { ) {

View File

@ -17,8 +17,9 @@
# #
define l23network::l2::bridge ( define l23network::l2::bridge (
$external_ids = '', $external_ids = '',
$provider = 'ovs',
$ensure = present, $ensure = present,
$skip_existing = false, $skip_existing = false
) { ) {
if ! $::l23network::l2::use_ovs { if ! $::l23network::l2::use_ovs {
fail('You must enable Open vSwitch by setting the l23network::l2::use_ovs to true.') fail('You must enable Open vSwitch by setting the l23network::l2::use_ovs to true.')

View File

@ -27,7 +27,9 @@ define l23network::l2::patch (
$peers = [undef,undef], $peers = [undef,undef],
$tags = [0, 0], $tags = [0, 0],
$trunks = [], $trunks = [],
$provider = 'ovs',
$ensure = present, $ensure = present,
$skip_existing = false
) { ) {
if ! $::l23network::l2::use_ovs { if ! $::l23network::l2::use_ovs {
fail('You must enable Open vSwitch by setting the l23network::l2::use_ovs to true.') fail('You must enable Open vSwitch by setting the l23network::l2::use_ovs to true.')

View File

@ -34,11 +34,12 @@ define l23network::l2::port (
$type = '', $type = '',
$port_properties = [], $port_properties = [],
$interface_properties = [], $interface_properties = [],
$ensure = present,
$skip_existing = false,
$tag = 0, $tag = 0,
$trunks = [], $trunks = [],
$vlan_splinters= false $vlan_splinters= false,
$provider = 'ovs',
$ensure = present,
$skip_existing = false
) { ) {
if ! $::l23network::l2::use_ovs { if ! $::l23network::l2::use_ovs {
fail('You must enable Open vSwitch by setting the l23network::l2::use_ovs to true.') fail('You must enable Open vSwitch by setting the l23network::l2::use_ovs to true.')

View File

@ -1,5 +1,5 @@
<%- if @ethtool_lines -%> <%- if @ethtool_lines -%>
<%- @ethtool_lines.each do |key,line| -%> <%- @ethtool_lines.each do |key,line| -%>
post-up ethtool <%= key %> <%= interface %> <%= line %> || true post-up ethtool <%= key %> <%= @interface %> <%= line %> || true
<%- end -%> <%- end -%>
<%- end -%> <%- end -%>

View File

@ -1,5 +1,5 @@
auto <%= interface %> auto <%= @interface %>
iface <%= interface %> inet manual iface <%= @interface %> inet manual
bond-master <%= @bond_master %> bond-master <%= @bond_master %>
<% if @macaddr -%> <% if @macaddr -%>
hwaddress ether <%= @macaddr.downcase %> hwaddress ether <%= @macaddr.downcase %>

View File

@ -1,5 +1,5 @@
auto <%= interface %> auto <%= @interface %>
iface <%= interface %> inet dhcp iface <%= @interface %> inet dhcp
<% if @macaddr -%> <% if @macaddr -%>
hwaddress ether <%= @macaddr.downcase %> hwaddress ether <%= @macaddr.downcase %>
<% end -%> <% end -%>

View File

@ -1,4 +1,4 @@
DEVICE=<%= interface %> DEVICE=<%= @interface %>
BOOTPROTO=none BOOTPROTO=none
ONBOOT=yes ONBOOT=yes
USERCTL=no USERCTL=no

View File

@ -1,4 +1,4 @@
DEVICE=<%= interface %> DEVICE=<%= @interface %>
BOOTPROTO=dhcp BOOTPROTO=dhcp
ONBOOT=yes ONBOOT=yes
USERCTL=no USERCTL=no

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
<%- if @ipaddr_aliases -%> <%- if @ipaddr_aliases -%>
<%- @ipaddr_aliases.each do |addr| -%> <%- @ipaddr_aliases.each do |addr| -%>
ip addr del <%= addr %> dev <%= interface %> ip addr del <%= addr %> dev <%= @interface %>
<%- end -%> <%- end -%>
<%- end -%> <%- end -%>
true true

View File

@ -1,12 +1,12 @@
#!/bin/sh #!/bin/sh
<%- if @ipaddr_aliases -%> <%- if @ipaddr_aliases -%>
<%- @ipaddr_aliases.each do |addr| -%> <%- @ipaddr_aliases.each do |addr| -%>
ip addr add <%= addr %> dev <%= interface %> ip addr add <%= addr %> dev <%= @interface %>
<%- end -%> <%- end -%>
<%- end -%> <%- end -%>
<%- if @ethtool_lines -%> <%- if @ethtool_lines -%>
<%- @ethtool_lines.each do |key,line| -%> <%- @ethtool_lines.each do |key,line| -%>
ethtool <%= key %> <%= interface %> <%= line %> ethtool <%= key %> <%= @interface %> <%= line %>
<%- end -%> <%- end -%>
<%- end -%> <%- end -%>
true true