Commit 01b9721c authored by Jérémie Gaidamour's avatar Jérémie Gaidamour
Browse files

[dev] Manage kavlan entries for multiple eth interfaces

parent 7b37cc6c
......@@ -48,23 +48,23 @@ nodes:
<% i149_165 = i+148 %>
kavlan:
kavlan-1: 192.168.202.<%= i %>
kavlan-2: 192.168.218.<%= i %>
kavlan-3: 192.168.233.<%= i %>
kavlan-4: 10.16.10.<%= i %>
kavlan-5: 10.16.74.<%= i %>
kavlan-6: 10.16.138.<%= i %>
kavlan-7: 10.16.202.<%= i %>
kavlan-8: 10.17.10.<%= i %>
kavlan-9: 10.17.74.<%= i %>
kavlan-11: 10.7.201.<%= i149_165 %>
kavlan-12: 10.11.201.<%= i149_165 %>
kavlan-13: 10.15.201.<%= i149_165 %>
kavlan-14: 10.19.201.<%= i149_165 %>
kavlan-16: 10.27.201.<%= i149_165 %>
kavlan-17: 10.31.201.<%= i149_165 %>
kavlan-18: 10.35.201.<%= i149_165 %>
kavlan-19: 10.39.201.<%= i149_165 %>
kavlan-20: 10.43.201.<%= i149_165 %>
kavlan-21: 10.47.201.<%= i149_165 %>
eth0:
kavlan-1: 192.168.202.<%= i %>
kavlan-2: 192.168.218.<%= i %>
kavlan-3: 192.168.233.<%= i %>
kavlan-4: 10.16.10.<%= i %>
kavlan-5: 10.16.74.<%= i %>
kavlan-6: 10.16.138.<%= i %>
kavlan-7: 10.16.202.<%= i %>
kavlan-8: 10.17.10.<%= i %>
kavlan-9: 10.17.74.<%= i %>
kavlan-11: 10.7.201.<%= i149_165 %>
kavlan-12: 10.11.201.<%= i149_165 %>
kavlan-13: 10.15.201.<%= i149_165 %>
kavlan-14: 10.19.201.<%= i149_165 %>
kavlan-16: 10.27.201.<%= i149_165 %>
kavlan-18: 10.35.201.<%= i149_165 %>
kavlan-19: 10.39.201.<%= i149_165 %>
kavlan-20: 10.43.201.<%= i149_165 %>
kavlan-21: 10.47.201.<%= i149_165 %>
<% } %>
......@@ -41,23 +41,24 @@ nodes:
<% i166_174 = i + 165 %>
kavlan:
kavlan-1: 192.168.203.<%= i %>
kavlan-2: 192.168.219.<%= i %>
kavlan-3: 192.168.234.<%= i %>
kavlan-4: 10.16.11.<%= i %>
kavlan-5: 10.16.75.<%= i %>
kavlan-6: 10.16.139.<%= i %>
kavlan-7: 10.16.203.<%= i %>
kavlan-8: 10.17.11.<%= i %>
kavlan-9: 10.17.75.<%= i %>
kavlan-11: 10.7.201.<%= i166_174 %>
kavlan-12: 10.11.201.<%= i166_174 %>
kavlan-13: 10.15.201.<%= i166_174 %>
kavlan-14: 10.19.201.<%= i166_174 %>
kavlan-16: 10.27.201.<%= i166_174 %>
kavlan-17: 10.31.201.<%= i166_174 %>
kavlan-18: 10.35.201.<%= i166_174 %>
kavlan-19: 10.39.201.<%= i166_174 %>
kavlan-20: 10.43.201.<%= i166_174 %>
kavlan-21: 10.47.201.<%= i166_174 %>
eth0:
kavlan-1: 192.168.203.<%= i %>
kavlan-2: 192.168.219.<%= i %>
kavlan-3: 192.168.234.<%= i %>
kavlan-4: 10.16.11.<%= i %>
kavlan-5: 10.16.75.<%= i %>
kavlan-6: 10.16.139.<%= i %>
kavlan-7: 10.16.203.<%= i %>
kavlan-8: 10.17.11.<%= i %>
kavlan-9: 10.17.75.<%= i %>
kavlan-11: 10.7.201.<%= i166_174 %>
kavlan-12: 10.11.201.<%= i166_174 %>
kavlan-13: 10.15.201.<%= i166_174 %>
kavlan-14: 10.19.201.<%= i166_174 %>
kavlan-16: 10.27.201.<%= i166_174 %>
kavlan-17: 10.31.201.<%= i166_174 %>
kavlan-18: 10.35.201.<%= i166_174 %>
kavlan-19: 10.39.201.<%= i166_174 %>
kavlan-20: 10.43.201.<%= i166_174 %>
kavlan-21: 10.47.201.<%= i166_174 %>
<% } %>
......@@ -128,25 +128,58 @@ nodes:
64:00:6a:c0:e5:ba
)[i-1] %>
<% i175_226 = i+174 %>
kavlan:
kavlan-1: 192.168.204.<%= i %>
kavlan-2: 192.168.220.<%= i %>
kavlan-3: 192.168.235.<%= i %>
kavlan-4: 10.16.12.<%= i %>
kavlan-5: 10.16.76.<%= i %>
kavlan-6: 10.16.140.<%= i %>
kavlan-7: 10.16.204.<%= i %>
kavlan-8: 10.17.12.<%= i %>
kavlan-9: 10.17.76.<%= i %>
kavlan-11: 10.7.201.<%= i175_226 %>
kavlan-12: 10.11.201.<%= i175_226 %>
kavlan-13: 10.15.201.<%= i175_226 %>
kavlan-14: 10.19.201.<%= i175_226 %>
kavlan-16: 10.27.201.<%= i175_226 %>
kavlan-17: 10.31.201.<%= i175_226 %>
kavlan-18: 10.35.201.<%= i175_226 %>
kavlan-19: 10.39.201.<%= i175_226 %>
kavlan-20: 10.43.201.<%= i175_226 %>
kavlan-21: 10.47.201.<%= i175_226 %>
eth0:
<% i175_226 = i+174 %>
kavlan-1: 192.168.204.<%= i %>
kavlan-2: 192.168.220.<%= i %>
kavlan-3: 192.168.235.<%= i %>
kavlan-4: 10.16.12.<%= i %>
kavlan-5: 10.16.76.<%= i %>
kavlan-6: 10.16.140.<%= i %>
kavlan-7: 10.16.204.<%= i %>
kavlan-8: 10.17.12.<%= i %>
kavlan-9: 10.17.76.<%= i %>
kavlan-11: 10.7.201.<%= i175_226 %>
kavlan-12: 10.11.201.<%= i175_226 %>
kavlan-13: 10.15.201.<%= i175_226 %>
kavlan-14: 10.19.201.<%= i175_226 %>
kavlan-16: 10.27.201.<%= i175_226 %>
kavlan-18: 10.35.201.<%= i175_226 %>
kavlan-19: 10.39.201.<%= i175_226 %>
kavlan-20: 10.43.201.<%= i175_226 %>
kavlan-21: 10.47.201.<%= i175_226 %>
eth1:
<% i61 = i+60 %>
kavlan-1: 192.168.204.<%= i61 %>
kavlan-2: 192.168.220.<%= i61 %>
kavlan-3: 192.168.235.<%= i61 %>
kavlan-4: 10.16.12.<%= i61 %>
kavlan-5: 10.16.76.<%= i61 %>
kavlan-6: 10.16.140.<%= i61 %>
kavlan-7: 10.16.204.<%= i61 %>
kavlan-8: 10.17.12.<%= i61 %>
kavlan-9: 10.17.76.<%= i61 %>
eth2:
<% i121 = i+120 %>
kavlan-1: 192.168.204.<%= i121 %>
kavlan-2: 192.168.220.<%= i121 %>
kavlan-3: 192.168.235.<%= i121 %>
kavlan-4: 10.16.12.<%= i121 %>
kavlan-5: 10.16.76.<%= i121 %>
kavlan-6: 10.16.140.<%= i121 %>
kavlan-7: 10.16.204.<%= i121 %>
kavlan-8: 10.17.12.<%= i121 %>
kavlan-9: 10.17.76.<%= i121 %>
eth3:
<% i181 = i+180 %>
kavlan-1: 192.168.204.<%= i181 %>
kavlan-2: 192.168.220.<%= i181 %>
kavlan-3: 192.168.235.<%= i181 %>
kavlan-4: 10.16.12.<%= i181 %>
kavlan-5: 10.16.76.<%= i181 %>
kavlan-6: 10.16.140.<%= i181 %>
kavlan-7: 10.16.204.<%= i181 %>
kavlan-8: 10.17.12.<%= i181 %>
kavlan-9: 10.17.76.<%= i181 %>
<% } %>
......@@ -140,4 +140,25 @@ nodes:
00:E0:81:4F:CA:76
00:E0:81:4F:E3:0F
)[i-1] %>
kavlan:
eth0:
kavlan-1: 192.168.195.<%= i %>
kavlan-2: 192.168.211.<%= i %>
kavlan-3: 192.168.227.<%= i %>
kavlan-4: 10.16.3.<%= i %>
kavlan-5: 10.16.67.<%= i %>
kavlan-6: 10.16.131.<%= i %>
kavlan-7: 10.16.195.<%= i %>
kavlan-8: 10.17.3.<%= i %>
kavlan-9: 10.17.67.<%= i %>
kavlan-11: 10.7.201.<%= i %>
kavlan-12: 10.11.201.<%= i %>
kavlan-13: 10.15.201.<%= i %>
kavlan-14: 10.19.201.<%= i %>
kavlan-16: 10.27.201.<%= i %>
kavlan-18: 10.35.201.<%= i %>
kavlan-19: 10.39.201.<%= i %>
kavlan-20: 10.43.201.<%= i %>
kavlan-21: 10.47.201.<%= i %>
<% } %>
......@@ -53,3 +53,8 @@ sgriffon1:
mounted: true
ip: 172.17.79.205
mac: 00:22:57:77:CD:81
sgraoullyib:
network_adapters:
ib0:
ip: 172.17.79.223
......@@ -114,8 +114,10 @@ refapi["sites"].each { |site_uid, site|
}
# Kavlan
node.fetch('kavlan').each { |net_uid, ip|
network_adapters[net_uid] = {"ip" => ip, "mounted" => nil}
node.fetch('kavlan').each { |net_uid, net_hash|
net_hash.each { |kavlan_net_uid, ip|
network_adapters["#{net_uid}-#{kavlan_net_uid}"] = {"ip" => ip, "mounted" => nil}
}
} if node['kavlan']
# Mic
......@@ -139,20 +141,27 @@ refapi["sites"].each { |site_uid, site|
else
# CNAME entries
hostsuffix = "-#{net_uid}"
cnamesuffix = nil # no CNAME entry by default
if net_hash['mounted'] && /^eth[0-9]$/.match(net_uid)
# primary interface
cnamesuffix = ''
elsif /^kavlan-[0-9]*$/.match(net_uid)
cnamesuffix = '' # CNAME enabled for primary interface
elsif /^*-kavlan-[0-9]*$/.match(net_uid)
# kavlan
net_primaries = network_adapters.select{ |u, h| h['mounted'] && /^eth[0-9]$/.match(u) }
cnamesuffix = "-#{net_primaries.keys.first}-#{net_uid}" # -eth0-kavlan-1
net_primaries = network_adapters.select{ |u, h| h['mounted'] && /^eth[0-9]$/.match(u) } # list of primary interfaces
net_uid_eth, net_uid_kavlan = net_uid.to_s.scan(/^([^-]*)-(.*)$/).first # split 'eth0-kavlan-1'
# CNAME only for primary interface kavlan
if net_primaries.include?(net_uid_eth)
hostsuffix = "-#{net_uid_kavlan}" # -kavlan-1
cnamesuffix = "-#{net_uid}" # -eth0-kavlan-1
end
end
# new range
new_entry = {
:uid => cluster_uid,
:hostsuffix => "-#{net_uid}", # -eth0, -kavlan-1
:hostsuffix => hostsuffix, # -eth0, -kavlan-1
:cnamesuffix => cnamesuffix, # graoully-$-, graoully-$-eth0-kavlan-1
:start => node_id,
:end => node_id,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment