Fix OVS-related issues with underlay networking
* more intelligent calculation of default port provider * additional check of patchcord existing in the bridge OVS provider should be used for fake (OVS) ports, inserted into OVS bridge. OVS provider should be used for inserting native linux interface into OVS bridge. But if we try to add native linux subinterface into OVS bridge we should use lnx provider for creating such port correctly. Change-Id: Ib76b3340eca1ea22095da1cfffe7c224a139fb71 Closes-bug: #1682835
This commit is contained in:
parent
7453b8bf9d
commit
d096bfe121
@ -419,7 +419,9 @@ Puppet::Parser::Functions::newfunction(:generate_network_config, :type => :rvalu
|
||||
end
|
||||
|
||||
if !trans[:provider]
|
||||
if action == :port && trans[:bridge]
|
||||
if action == :port && trans[:bridge] && ((trans[:vlan_dev] && trans[:vlan_id]) or trans[:name]=~/\.\d+/)
|
||||
trans[:provider] = default_provider
|
||||
elsif action == :port && trans[:bridge]
|
||||
provider = L23network.get_property_for_transformation('PROVIDER', trans[:bridge], lookupvar('l3_fqdn_hostname'))
|
||||
trans[:provider] = provider || default_provider
|
||||
else
|
||||
|
@ -0,0 +1,173 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'l23network::examples::run_network_scheme', :type => :class do
|
||||
context 'network scheme with OVS bridge and native lnx subinterface with ethN.XXX naming into it' do
|
||||
let(:title) { 'test network scheme' }
|
||||
let(:facts) {
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:kernel => 'Linux',
|
||||
:l23_os => 'ubuntu',
|
||||
:l3_fqdn_hostname => 'stupid_hostname',
|
||||
}
|
||||
}
|
||||
|
||||
let(:params) {{
|
||||
:settings_yaml => '''
|
||||
network_scheme:
|
||||
version: 1.1
|
||||
provider: lnx
|
||||
interfaces:
|
||||
eth1: {}
|
||||
transformations:
|
||||
- action: add-br
|
||||
name: xxx
|
||||
provider: ovs
|
||||
- action: add-port
|
||||
name: eth1.101
|
||||
bridge: xxx
|
||||
'''
|
||||
}}
|
||||
|
||||
before(:each) do
|
||||
puppet_debug_override()
|
||||
end
|
||||
|
||||
it { is_expected.to compile.with_all_deps }
|
||||
it { is_expected.to contain_l23network__l2__port('eth1.101') }
|
||||
it { is_expected.to contain_l23network__l2__port('eth1.101').with({
|
||||
'provider' => 'lnx',
|
||||
})}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'l23network::examples::run_network_scheme', :type => :class do
|
||||
context 'network scheme with OVS bridge and native lnx subinterface with vlanXXX naming into it' do
|
||||
let(:title) { 'test network scheme' }
|
||||
let(:facts) {
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:kernel => 'Linux',
|
||||
:l23_os => 'ubuntu',
|
||||
:l3_fqdn_hostname => 'stupid_hostname',
|
||||
}
|
||||
}
|
||||
|
||||
let(:params) {{
|
||||
:settings_yaml => '''
|
||||
network_scheme:
|
||||
version: 1.1
|
||||
provider: lnx
|
||||
interfaces:
|
||||
eth1: {}
|
||||
transformations:
|
||||
- action: add-br
|
||||
name: xxx
|
||||
provider: ovs
|
||||
- action: add-port
|
||||
name: vlan101
|
||||
vlan_dev: eth1
|
||||
vlan_id: 101
|
||||
bridge: xxx
|
||||
'''
|
||||
}}
|
||||
|
||||
before(:each) do
|
||||
puppet_debug_override()
|
||||
end
|
||||
|
||||
it { is_expected.to compile.with_all_deps }
|
||||
it { is_expected.to contain_l23network__l2__port('vlan101') }
|
||||
it { is_expected.to contain_l23network__l2__port('vlan101').with({
|
||||
'provider' => 'lnx',
|
||||
})}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'l23network::examples::run_network_scheme', :type => :class do
|
||||
context 'network scheme with OVS bridge and native lnx interface into it' do
|
||||
let(:title) { 'test network scheme' }
|
||||
let(:facts) {
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:kernel => 'Linux',
|
||||
:l23_os => 'ubuntu',
|
||||
:l3_fqdn_hostname => 'stupid_hostname',
|
||||
}
|
||||
}
|
||||
|
||||
let(:params) {{
|
||||
:settings_yaml => '''
|
||||
network_scheme:
|
||||
version: 1.1
|
||||
provider: lnx
|
||||
interfaces:
|
||||
eth1: {}
|
||||
transformations:
|
||||
- action: add-br
|
||||
name: xxx
|
||||
provider: ovs
|
||||
- action: add-port
|
||||
name: eth1
|
||||
bridge: xxx
|
||||
'''
|
||||
}}
|
||||
|
||||
before(:each) do
|
||||
puppet_debug_override()
|
||||
end
|
||||
|
||||
it { is_expected.to compile.with_all_deps }
|
||||
it { is_expected.to contain_l23network__l2__port('eth1') }
|
||||
it { is_expected.to contain_l23network__l2__port('eth1').with({
|
||||
'provider' => 'ovs',
|
||||
})}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'l23network::examples::run_network_scheme', :type => :class do
|
||||
context 'network scheme with OVS bridge and ovs fake interface into it' do
|
||||
let(:title) { 'test network scheme' }
|
||||
let(:facts) {
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:kernel => 'Linux',
|
||||
:l23_os => 'ubuntu',
|
||||
:l3_fqdn_hostname => 'stupid_hostname',
|
||||
}
|
||||
}
|
||||
|
||||
let(:params) {{
|
||||
:settings_yaml => '''
|
||||
network_scheme:
|
||||
version: 1.1
|
||||
provider: lnx
|
||||
interfaces:
|
||||
eth1: {}
|
||||
transformations:
|
||||
- action: add-br
|
||||
name: xxx
|
||||
provider: ovs
|
||||
- action: add-port
|
||||
name: yyy
|
||||
bridge: xxx
|
||||
'''
|
||||
}}
|
||||
|
||||
before(:each) do
|
||||
puppet_debug_override()
|
||||
end
|
||||
|
||||
it { is_expected.to compile.with_all_deps }
|
||||
it { is_expected.to contain_l23network__l2__port('yyy') }
|
||||
it { is_expected.to contain_l23network__l2__port('yyy').with({
|
||||
'provider' => 'ovs',
|
||||
})}
|
||||
end
|
||||
end
|
||||
|
||||
###
|
@ -475,6 +475,19 @@ ip_stop() {
|
||||
return $rc
|
||||
}
|
||||
|
||||
check_patchcord_exists_in_bridge() {
|
||||
local br="$1"
|
||||
local veth="$2"
|
||||
if [[ -d /sys/class/net/${br}/brif ]] ; then
|
||||
# LNX
|
||||
test -L /sys/class/net/${br}/brif/${veth} || return $OCF_ERR_GENERIC
|
||||
else
|
||||
# OVS
|
||||
ovs-vsctl list-ports "${br}" | grep "${veth}" || return $OCF_ERR_GENERIC
|
||||
fi
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
ip_monitor() {
|
||||
local rc
|
||||
ip_validate
|
||||
@ -483,6 +496,8 @@ ip_monitor() {
|
||||
|
||||
[ -z "$iface" ] && return $OCF_NOT_RUNNING
|
||||
|
||||
check_patchcord_exists_in_bridge $OCF_RESKEY_bridge $OCF_RESKEY_base_veth || return $OCF_ERR_GENERIC
|
||||
|
||||
check_interfaces_for_up_state "$OCF_RESKEY_bridge:$OCF_RESKEY_also_check_interfaces" || return $OCF_NOT_RUNNING
|
||||
# use arping here, because no IP from VIP network allowed on host system
|
||||
ocf_run arping -c 10 -w 2 -I $OCF_RESKEY_bridge $OCF_RESKEY_ip || return $OCF_NOT_RUNNING
|
||||
|
Loading…
Reference in New Issue
Block a user