summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vasilenko <svasilenko@mirantis.com>2017-04-21 16:27:34 +0300
committerSergey Vasilenko <svasilenko@mirantis.com>2017-04-28 16:01:58 +0000
commitd096bfe121cba47ae27f5f803d3d65b239910c1e (patch)
tree159c6a1c81bb35decfcdf90ae7522bcadf151869
parent7453b8bf9dde97427b6e4bd80be4974413bee411 (diff)
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
Notes
Notes (review): Verified+1: Fuel CI <fuel-ci-bot@mirantis.com> Code-Review+2: Sergii Golovatiuk <sgolovatiuk@mirantis.com> Code-Review+1: Michael Polenchuk <mpolenchuk@mirantis.com> Code-Review+2: Stanislaw Bogatkin <sbogatkin@mirantis.com> Workflow+1: Sergii Golovatiuk <sgolovatiuk@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 03 May 2017 12:45:31 +0000 Reviewed-on: https://review.openstack.org/458881 Project: openstack/fuel-library Branch: refs/heads/master
-rw-r--r--deployment/puppet/l23network/lib/puppet/parser/functions/generate_network_config.rb4
-rw-r--r--deployment/puppet/l23network/spec/classes/l2_lnx_subinterfaces_into_ovs_bridge__spec.rb173
-rwxr-xr-xfiles/fuel-ha-utils/ocf/ns_IPaddr215
3 files changed, 191 insertions, 1 deletions
diff --git a/deployment/puppet/l23network/lib/puppet/parser/functions/generate_network_config.rb b/deployment/puppet/l23network/lib/puppet/parser/functions/generate_network_config.rb
index 55224b9..1b0d234 100644
--- a/deployment/puppet/l23network/lib/puppet/parser/functions/generate_network_config.rb
+++ b/deployment/puppet/l23network/lib/puppet/parser/functions/generate_network_config.rb
@@ -419,7 +419,9 @@ Puppet::Parser::Functions::newfunction(:generate_network_config, :type => :rvalu
419 end 419 end
420 420
421 if !trans[:provider] 421 if !trans[:provider]
422 if action == :port && trans[:bridge] 422 if action == :port && trans[:bridge] && ((trans[:vlan_dev] && trans[:vlan_id]) or trans[:name]=~/\.\d+/)
423 trans[:provider] = default_provider
424 elsif action == :port && trans[:bridge]
423 provider = L23network.get_property_for_transformation('PROVIDER', trans[:bridge], lookupvar('l3_fqdn_hostname')) 425 provider = L23network.get_property_for_transformation('PROVIDER', trans[:bridge], lookupvar('l3_fqdn_hostname'))
424 trans[:provider] = provider || default_provider 426 trans[:provider] = provider || default_provider
425 else 427 else
diff --git a/deployment/puppet/l23network/spec/classes/l2_lnx_subinterfaces_into_ovs_bridge__spec.rb b/deployment/puppet/l23network/spec/classes/l2_lnx_subinterfaces_into_ovs_bridge__spec.rb
new file mode 100644
index 0000000..cfbccf5
--- /dev/null
+++ b/deployment/puppet/l23network/spec/classes/l2_lnx_subinterfaces_into_ovs_bridge__spec.rb
@@ -0,0 +1,173 @@
1require 'spec_helper'
2
3describe 'l23network::examples::run_network_scheme', :type => :class do
4 context 'network scheme with OVS bridge and native lnx subinterface with ethN.XXX naming into it' do
5 let(:title) { 'test network scheme' }
6 let(:facts) {
7 {
8 :osfamily => 'Debian',
9 :operatingsystem => 'Ubuntu',
10 :kernel => 'Linux',
11 :l23_os => 'ubuntu',
12 :l3_fqdn_hostname => 'stupid_hostname',
13 }
14 }
15
16 let(:params) {{
17 :settings_yaml => '''
18 network_scheme:
19 version: 1.1
20 provider: lnx
21 interfaces:
22 eth1: {}
23 transformations:
24 - action: add-br
25 name: xxx
26 provider: ovs
27 - action: add-port
28 name: eth1.101
29 bridge: xxx
30 '''
31 }}
32
33 before(:each) do
34 puppet_debug_override()
35 end
36
37 it { is_expected.to compile.with_all_deps }
38 it { is_expected.to contain_l23network__l2__port('eth1.101') }
39 it { is_expected.to contain_l23network__l2__port('eth1.101').with({
40 'provider' => 'lnx',
41 })}
42 end
43end
44
45describe 'l23network::examples::run_network_scheme', :type => :class do
46 context 'network scheme with OVS bridge and native lnx subinterface with vlanXXX naming into it' do
47 let(:title) { 'test network scheme' }
48 let(:facts) {
49 {
50 :osfamily => 'Debian',
51 :operatingsystem => 'Ubuntu',
52 :kernel => 'Linux',
53 :l23_os => 'ubuntu',
54 :l3_fqdn_hostname => 'stupid_hostname',
55 }
56 }
57
58 let(:params) {{
59 :settings_yaml => '''
60 network_scheme:
61 version: 1.1
62 provider: lnx
63 interfaces:
64 eth1: {}
65 transformations:
66 - action: add-br
67 name: xxx
68 provider: ovs
69 - action: add-port
70 name: vlan101
71 vlan_dev: eth1
72 vlan_id: 101
73 bridge: xxx
74 '''
75 }}
76
77 before(:each) do
78 puppet_debug_override()
79 end
80
81 it { is_expected.to compile.with_all_deps }
82 it { is_expected.to contain_l23network__l2__port('vlan101') }
83 it { is_expected.to contain_l23network__l2__port('vlan101').with({
84 'provider' => 'lnx',
85 })}
86 end
87end
88
89describe 'l23network::examples::run_network_scheme', :type => :class do
90 context 'network scheme with OVS bridge and native lnx interface into it' do
91 let(:title) { 'test network scheme' }
92 let(:facts) {
93 {
94 :osfamily => 'Debian',
95 :operatingsystem => 'Ubuntu',
96 :kernel => 'Linux',
97 :l23_os => 'ubuntu',
98 :l3_fqdn_hostname => 'stupid_hostname',
99 }
100 }
101
102 let(:params) {{
103 :settings_yaml => '''
104 network_scheme:
105 version: 1.1
106 provider: lnx
107 interfaces:
108 eth1: {}
109 transformations:
110 - action: add-br
111 name: xxx
112 provider: ovs
113 - action: add-port
114 name: eth1
115 bridge: xxx
116 '''
117 }}
118
119 before(:each) do
120 puppet_debug_override()
121 end
122
123 it { is_expected.to compile.with_all_deps }
124 it { is_expected.to contain_l23network__l2__port('eth1') }
125 it { is_expected.to contain_l23network__l2__port('eth1').with({
126 'provider' => 'ovs',
127 })}
128 end
129end
130
131describe 'l23network::examples::run_network_scheme', :type => :class do
132 context 'network scheme with OVS bridge and ovs fake interface into it' do
133 let(:title) { 'test network scheme' }
134 let(:facts) {
135 {
136 :osfamily => 'Debian',
137 :operatingsystem => 'Ubuntu',
138 :kernel => 'Linux',
139 :l23_os => 'ubuntu',
140 :l3_fqdn_hostname => 'stupid_hostname',
141 }
142 }
143
144 let(:params) {{
145 :settings_yaml => '''
146 network_scheme:
147 version: 1.1
148 provider: lnx
149 interfaces:
150 eth1: {}
151 transformations:
152 - action: add-br
153 name: xxx
154 provider: ovs
155 - action: add-port
156 name: yyy
157 bridge: xxx
158 '''
159 }}
160
161 before(:each) do
162 puppet_debug_override()
163 end
164
165 it { is_expected.to compile.with_all_deps }
166 it { is_expected.to contain_l23network__l2__port('yyy') }
167 it { is_expected.to contain_l23network__l2__port('yyy').with({
168 'provider' => 'ovs',
169 })}
170 end
171end
172
173###
diff --git a/files/fuel-ha-utils/ocf/ns_IPaddr2 b/files/fuel-ha-utils/ocf/ns_IPaddr2
index d1ce510..ad9bbcc 100755
--- a/files/fuel-ha-utils/ocf/ns_IPaddr2
+++ b/files/fuel-ha-utils/ocf/ns_IPaddr2
@@ -475,6 +475,19 @@ ip_stop() {
475 return $rc 475 return $rc
476} 476}
477 477
478check_patchcord_exists_in_bridge() {
479 local br="$1"
480 local veth="$2"
481 if [[ -d /sys/class/net/${br}/brif ]] ; then
482 # LNX
483 test -L /sys/class/net/${br}/brif/${veth} || return $OCF_ERR_GENERIC
484 else
485 # OVS
486 ovs-vsctl list-ports "${br}" | grep "${veth}" || return $OCF_ERR_GENERIC
487 fi
488 return $OCF_SUCCESS
489}
490
478ip_monitor() { 491ip_monitor() {
479 local rc 492 local rc
480 ip_validate 493 ip_validate
@@ -483,6 +496,8 @@ ip_monitor() {
483 496
484 [ -z "$iface" ] && return $OCF_NOT_RUNNING 497 [ -z "$iface" ] && return $OCF_NOT_RUNNING
485 498
499 check_patchcord_exists_in_bridge $OCF_RESKEY_bridge $OCF_RESKEY_base_veth || return $OCF_ERR_GENERIC
500
486 check_interfaces_for_up_state "$OCF_RESKEY_bridge:$OCF_RESKEY_also_check_interfaces" || return $OCF_NOT_RUNNING 501 check_interfaces_for_up_state "$OCF_RESKEY_bridge:$OCF_RESKEY_also_check_interfaces" || return $OCF_NOT_RUNNING
487 # use arping here, because no IP from VIP network allowed on host system 502 # use arping here, because no IP from VIP network allowed on host system
488 ocf_run arping -c 10 -w 2 -I $OCF_RESKEY_bridge $OCF_RESKEY_ip || return $OCF_NOT_RUNNING 503 ocf_run arping -c 10 -w 2 -I $OCF_RESKEY_bridge $OCF_RESKEY_ip || return $OCF_NOT_RUNNING