Specify default delay while boot for LACP bonds.
Hardcode 45s delay for LACP bonds and 15s for non-LACP. Only at node boot time. System administrator can re-define this value by CLI This patchset is a workaround and should be reverted in 7.0 after implementing this feature in UI Change-Id: I329e26a0b4da1b2be676dd7f8e6eb39e89eb11f4 Related-bug: #1441435 Related-bug: #1456436
This commit is contained in:
parent
83237e26e2
commit
114b470f4a
|
@ -84,6 +84,7 @@ Non-obligatory fields:
|
|||
* *bpdu_forward* -- enable/disable BPDU forward on bridge
|
||||
* *bridge_id* -- bridge_id for STP protocol.
|
||||
* *vendor_specific* -- vendor_specific hash (see below)
|
||||
* *delay_while_up* -- delay, in seconds, which will happens each time while node will boot after interface up.
|
||||
|
||||
#### L2::Port
|
||||
|
||||
|
@ -91,15 +92,15 @@ Resource for configuring port L2 options. Only L2 options. For configuring
|
|||
L3 options -- use *L23network::l3::ifconfig* resource
|
||||
|
||||
l23network::l2::port { 'eth1':
|
||||
mtu => 9000, # MTU value, unchanged if absent.
|
||||
onboot => true, # whether port has UP state after setup or node boot
|
||||
mtu => 9000, # MTU value, unchanged if absent.
|
||||
onboot => true, # whether port has UP state after setup or node boot
|
||||
ethtool => {
|
||||
.....
|
||||
},
|
||||
vendor_specific => {
|
||||
.....
|
||||
},
|
||||
provider => lnx
|
||||
provider => lnx
|
||||
}
|
||||
|
||||
l23network::l2::port { 'eth1.101':
|
||||
|
@ -109,6 +110,7 @@ L3 options -- use *L23network::l3::ifconfig* resource
|
|||
# if given 'absent' port will be excluded from any
|
||||
# bridges.
|
||||
onboot => true,
|
||||
delay_while_up => 10
|
||||
provider => lnx
|
||||
}
|
||||
|
||||
|
@ -146,6 +148,7 @@ Also we don't recommend insert native linux bonds to OVS bridges. This case work
|
|||
vendor_specific => {
|
||||
.....
|
||||
},
|
||||
delay_while_up => 45
|
||||
provider => lnx,
|
||||
}
|
||||
|
||||
|
@ -190,6 +193,8 @@ this ports by *l23network::l2::port* resource and shouldn't define
|
|||
**MTU** field, setted for bond interface will be passed to interfaces, included
|
||||
to the bond automatically.
|
||||
|
||||
I recommend use **delay_while_up** property, while configure LACP bonds, because such bonds may take some time for settle.
|
||||
|
||||
For some providers (ex: ovs) **bridge** field is obligatory.
|
||||
|
||||
#### L2::Patch
|
||||
|
|
|
@ -48,6 +48,7 @@ module L23network
|
|||
# :bridge_id => nil,
|
||||
:external_ids => nil,
|
||||
# :interface_properties => nil,
|
||||
:delay_while_up => nil,
|
||||
:vendor_specific => nil,
|
||||
:provider => def_provider
|
||||
}
|
||||
|
@ -281,6 +282,21 @@ Puppet::Parser::Functions::newfunction(:generate_network_config, :type => :rvalu
|
|||
end
|
||||
end
|
||||
|
||||
# add default delay for bonds. 45 sec. for LACP bonds and 15 sec for another.
|
||||
if (action == :bond) && trans[:bond_properties].is_a?(Hash) && trans[:delay_while_up].to_i == 0
|
||||
delay_while_up = ( trans[:bond_properties][:mode]=='802.3ad' ? 45 : 15 )
|
||||
if ['', 'absent'].include? trans[:bridge].to_s
|
||||
# bond not included to bridge. I.e. has IP address or subinterfaces and post-up has sense
|
||||
trans[:delay_while_up] = delay_while_up
|
||||
else
|
||||
# bond included to bridge. I.e. has no IP address
|
||||
bridge_res = findresource("L23network::L2::Bridge[#{trans[:bridge].to_s}]")
|
||||
if !bridge_res.nil? && bridge_res[:delay_while_up].nil?
|
||||
bridge_res[:delay_while_up] = delay_while_up
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# create puppet resources for transformations
|
||||
resource = res_factory[action]
|
||||
resource_properties = { }
|
||||
|
|
|
@ -19,6 +19,7 @@ define l23network::l2::bridge (
|
|||
$bpdu_forward = true,
|
||||
# $bridge_id = undef, # will be implemented later
|
||||
$external_ids = { 'bridge-id' => "${name}" },
|
||||
$delay_while_up = undef,
|
||||
$vendor_specific = undef,
|
||||
$provider = undef,
|
||||
) {
|
||||
|
@ -32,6 +33,10 @@ define l23network::l2::bridge (
|
|||
$config_provider = undef
|
||||
}
|
||||
|
||||
if $delay_while_up and ! is_numeric($delay_while_up) {
|
||||
fail("Delay for waiting after UP bridge ${name} should be numeric, not an '$delay_while_up'.")
|
||||
}
|
||||
|
||||
if ! defined (L23_stored_config[$name]) {
|
||||
l23_stored_config { $name: }
|
||||
}
|
||||
|
@ -43,6 +48,7 @@ define l23network::l2::bridge (
|
|||
bridge_stp => $stp,
|
||||
bridge_ports => ['none'], # this property will be fulled by l2_port
|
||||
vendor_specific => $vendor_specific,
|
||||
delay_while_up => $delay_while_up,
|
||||
provider => $config_provider
|
||||
}
|
||||
|
||||
|
@ -61,5 +67,21 @@ define l23network::l2::bridge (
|
|||
|
||||
Anchor['l23network::init'] -> K_mod<||> -> L2_bridge<||>
|
||||
}
|
||||
|
||||
if $::osfamily =~ /(?i)redhat/ {
|
||||
if $delay_while_up {
|
||||
file {"${::l23network::params::interfaces_dir}/interface-up-script-${name}":
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
mode => '0755',
|
||||
content => template("l23network/centos_post_up.erb"),
|
||||
} -> L23_stored_config <| title == $name |>
|
||||
} else {
|
||||
file {"${::l23network::params::interfaces_dir}/interface-up-script-${name}":
|
||||
ensure => absent,
|
||||
} -> L23_stored_config <| title == $name |>
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'l23network::examples::run_network_scheme', :type => :class do
|
||||
let(:network_scheme) do
|
||||
<<eof
|
||||
---
|
||||
network_scheme:
|
||||
version: 1.1
|
||||
provider: lnx
|
||||
interfaces:
|
||||
eth1: {}
|
||||
eth2: {}
|
||||
eth3: {}
|
||||
eth4: {}
|
||||
eth5: {}
|
||||
eth6: {}
|
||||
eth7: {}
|
||||
eth8: {}
|
||||
eth9: {}
|
||||
eth10: {}
|
||||
eth11: {}
|
||||
eth12: {}
|
||||
transformations:
|
||||
- action: add-bond
|
||||
name: bond0
|
||||
interfaces:
|
||||
- eth1
|
||||
- eth2
|
||||
bond_properties:
|
||||
mode: 802.3ad
|
||||
- action: add-bond
|
||||
name: bond1
|
||||
interfaces:
|
||||
- eth3
|
||||
- eth4
|
||||
bond_properties:
|
||||
mode: 802.3ad
|
||||
delay_while_up: 77
|
||||
- action: add-bond
|
||||
name: bond2
|
||||
interfaces:
|
||||
- eth5
|
||||
- eth6
|
||||
bond_properties:
|
||||
mode: balance-rr
|
||||
- action: add-bond
|
||||
name: bond3
|
||||
interfaces:
|
||||
- eth7
|
||||
- eth8
|
||||
bond_properties:
|
||||
mode: balance-rr
|
||||
delay_while_up: 77
|
||||
- action: add-br
|
||||
name: br910
|
||||
- action: add-bond
|
||||
name: bond910
|
||||
bridge: br910
|
||||
interfaces:
|
||||
- eth9
|
||||
- eth10
|
||||
bond_properties:
|
||||
mode: balance-rr
|
||||
- action: add-br
|
||||
name: br911
|
||||
delay_while_up: 77
|
||||
- action: add-bond
|
||||
name: bond911
|
||||
bridge: br911
|
||||
interfaces:
|
||||
- eth11
|
||||
- eth12
|
||||
bond_properties:
|
||||
mode: balance-rr
|
||||
endpoints: {}
|
||||
roles: {}
|
||||
eof
|
||||
end
|
||||
|
||||
context '"delay_while_up" property for' do
|
||||
let(:title) { 'lacp_bonds' }
|
||||
let(:facts) {
|
||||
{
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'Centos',
|
||||
:kernel => 'Linux',
|
||||
:l23_os => 'centos6',
|
||||
:l3_fqdn_hostname => 'stupid_hostname',
|
||||
}
|
||||
}
|
||||
|
||||
let(:params) do {
|
||||
:settings_yaml => network_scheme,
|
||||
} end
|
||||
|
||||
it do
|
||||
should compile
|
||||
end
|
||||
|
||||
it 'LACP bond without defined delay' do
|
||||
should contain_l23_stored_config('bond0').with({
|
||||
'delay_while_up' => '45',
|
||||
})
|
||||
end
|
||||
|
||||
it 'LACP bond with specified delay' do
|
||||
should contain_l23_stored_config('bond1').with({
|
||||
'delay_while_up' => '77',
|
||||
})
|
||||
end
|
||||
|
||||
it 'non LACP bond without defined delay' do
|
||||
should contain_l23_stored_config('bond2').with({
|
||||
'delay_while_up' => '15',
|
||||
})
|
||||
end
|
||||
|
||||
it 'non LACP bond with specified delay' do
|
||||
should contain_l23_stored_config('bond3').with({
|
||||
'delay_while_up' => '77',
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context '"delay_while_up" property for bond, included to bridge ' do
|
||||
let(:title) { 'lacp_bonds' }
|
||||
let(:facts) {
|
||||
{
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'Centos',
|
||||
:kernel => 'Linux',
|
||||
:l23_os => 'centos6',
|
||||
:l3_fqdn_hostname => 'stupid_hostname',
|
||||
}
|
||||
}
|
||||
|
||||
let(:params) do {
|
||||
:settings_yaml => network_scheme,
|
||||
} end
|
||||
|
||||
it 'bond should assembled without delay' do
|
||||
should contain_l23_stored_config('bond910').with({
|
||||
'delay_while_up' => nil,
|
||||
'bridge' => 'br910'
|
||||
})
|
||||
end
|
||||
|
||||
it 'bridge should contain delay from bond' do
|
||||
should contain_l23_stored_config('br910').with({
|
||||
'delay_while_up' => '15',
|
||||
})
|
||||
end
|
||||
|
||||
it "bridge's delay_while_up has more priority, than bond's" do
|
||||
should contain_l23_stored_config('br911').with({
|
||||
'delay_while_up' => '77',
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
###
|
|
@ -0,0 +1,107 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'l23network::examples::run_network_scheme', :type => :class do
|
||||
let(:network_scheme) do
|
||||
<<eof
|
||||
---
|
||||
network_scheme:
|
||||
version: 1.1
|
||||
provider: lnx
|
||||
interfaces:
|
||||
eth1: {}
|
||||
eth2: {}
|
||||
eth3: {}
|
||||
transformations:
|
||||
- action: add-br
|
||||
name: br1
|
||||
delay_while_up: 25
|
||||
- action: add-br
|
||||
name: br2
|
||||
endpoints: {}
|
||||
roles: {}
|
||||
eof
|
||||
end
|
||||
|
||||
context 'Centos should contain addition file for handle "delay_while_up" property.' do
|
||||
let(:title) { 'Centos has delay for port after boot' }
|
||||
let(:facts) {
|
||||
{
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'Centos',
|
||||
:kernel => 'Linux',
|
||||
:l23_os => 'centos6',
|
||||
:l3_fqdn_hostname => 'stupid_hostname',
|
||||
}
|
||||
}
|
||||
|
||||
let(:params) do {
|
||||
:settings_yaml => network_scheme,
|
||||
} end
|
||||
|
||||
it do
|
||||
should compile
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_l23_stored_config('br1').with({
|
||||
'delay_while_up' => '25',
|
||||
})
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_file('/etc/sysconfig/network-scripts/interface-up-script-br1').with_owner('root')
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_file('/etc/sysconfig/network-scripts/interface-up-script-br1').with_mode('0755')
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_file('/etc/sysconfig/network-scripts/interface-up-script-br1').with_content(/sleep\s+25/)
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_l23_stored_config('br2').with({
|
||||
'delay_while_up' => nil,
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'Property "delay_while_up" for port' do
|
||||
let(:title) { 'Property "delay_while_up" for port' }
|
||||
let(:facts) {
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:kernel => 'Linux',
|
||||
:l23_os => 'ubuntu',
|
||||
:l3_fqdn_hostname => 'stupid_hostname',
|
||||
}
|
||||
}
|
||||
|
||||
let(:params) do {
|
||||
:settings_yaml => network_scheme,
|
||||
} end
|
||||
|
||||
it do
|
||||
should compile
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_l23_stored_config('br1').with({
|
||||
'delay_while_up' => '25',
|
||||
})
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_l23_stored_config('br2').with({
|
||||
'delay_while_up' => nil,
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
###
|
Loading…
Reference in New Issue