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

[nancy] Fixed input for the dhcp generator

parent d22f0ebf
......@@ -36,7 +36,7 @@ graphene-96:
eth0:
mounted: true
rate: 1000000000
mac: 00:e0:81:d5:08:34
mac: '00:00:00:00:00:00' # retired node used as an opensm serv. Replaced mac address for avoiding dhcp problems # 00:E0:81:D5:08:34
ip6: fe80::2e0:81ff:fed5:834
management: false
enabled: true
......
......@@ -159,7 +159,7 @@ nodes:
timeread: 958
timewrite: 2963
mic:
ip: 172.16.68.87
ip: 172.16.68.7
mac: 4C:79:BA:5C:01:AC
graphite-4:
......
---
fgriffon1:
network_adapters:
eth0:
mac: 00:E0:81:B2:C1:A8
ip: 172.16.79.1
fgriffon2:
network_adapters:
eth0:
mounted: true
mac: 00:E0:81:B2:C0:16
ip: 172.16.79.2
adm:
mounted: true
ip: 172.17.79.2
mac: 00:E0:81:B2:C0:1D
bmc:
mounted: true
ip: 172.17.79.5
mac: 00:E0:81:4F:E3:63
grog:
network_adapters:
eth0:
mounted: true
mac: 84:2B:2B:60:15:6D
ip: 172.16.79.3
fgrelon1:
network_adapters:
eth0:
mac: 00:18:FE:7C:5F:B2
ip: 172.16.79.9
fgrelon2:
network_adapters:
eth0:
mac: 00:1B:78:9D:24:FE
ip: 172.16.79.10
adm:
mounted: true
ip: 172.17.79.3
mac: 84:2B:2B:60:15:6E
bmc:
mounted: true
ip: 172.17.79.6
mac: 84:2B:2B:60:15:6F
srv:
network_adapters:
eth0:
mac: A0:36:9F:28:10:AC
mounted: true
ip: 172.16.79.15
mac: A0:36:9F:28:10:AC
bmc:
mounted: true
ip: 172.17.79.15
mac: F0:1F:AF:E0:FA:DC
srv-data:
network_adapters:
eth0:
mounted: true
mac: A0:36:9F:2C:5D:B8
ip: 172.16.79.16
bmc:
mounted: true
ip: 172.17.79.16
mac: F0:1F:AF:E1:99:E4
gras:
network_adapters:
eth0:
mounted: true
mac: 00:0D:60:55:16:68
ip: 172.16.79.14
fmbi1:
network_adapters:
eth0:
mac: 00:E0:81:B0:5E:90
ip: 172.16.79.19
fmbi2:
network_adapters:
eth0:
mac: 00:E0:81:B2:C1:BC
ip: 172.16.79.20
......@@ -23,18 +23,14 @@ laptops:
user: emorel
network_adapters:
eth0:
mounted: true
ip: 172.16.79.6
mac: D4:BE:D9:73:E2:D4
grimoire:
user: sbadia
network_adapters:
eth0:
ip: 172.16.79.5
mac: 5C:26:0A:23:20:96
cacahuete:
user: cparisot
network_adapters:
eth0:
mounted: true
ip: 172.16.79.18
mac: EC:B1:D7:99:11:68
......
......@@ -2,43 +2,54 @@
sgraphene1:
network_adapters:
eth0:
mac: 40:01:C6:8B:E4:80
mounted: true
ip: 172.16.79.201
mac: 40:01:C6:8B:E4:80
bmc:
mounted: true
mac: 40:01:C6:BE:8E:40
ip: 172.17.79.201
sgraphene2:
network_adapters:
eth0:
mac: 40:01:C6:8C:06:00
mounted: true
ip: 172.16.79.202
mac: 40:01:C6:8C:06:00
bmc:
mounted: true
mac: 40:01:C6:BE:49:00
ip: 172.17.79.202
sgraphene3:
network_adapters:
eth0:
mac: 40:01:C6:8B:C2:00
mounted: true
ip: 172.16.79.203
mac: 40:01:C6:8B:C2:00
bmc:
mac: 40:01:C6:BE:4D:00
mounted: true
ip: 172.17.79.203
mac: 40:01:C6:BE:4D:00
sgraphene4:
network_adapters:
eth0:
mac: 40:01:C6:8B:EE:00
mounted: true
ip: 172.16.79.204
mac: 40:01:C6:8B:EE:00
bmc:
mounted: true
mac: 40:01:C6:BE:85:00
ip: 172.17.79.204
sgriffon1:
network_adapters:
eth0:
mac: 00:22:57:39:F1:81
mounted: true
ip: 172.16.79.205
mac: 00:22:57:39:F1:81
bmc:
mac: 00:22:57:77:CD:81
mounted: true
ip: 172.17.79.205
mac: 00:22:57:77:CD:81
......@@ -132,3 +132,11 @@ pdus:
grisou-pdu2:
ip: 172.17.79.248
mac: 00:C0:B7:85:13:65
griffon-pdu1:
ip: 172.17.79.216
mac: 00:C0:B7:4D:A4:B0
griffon-pdu2:
ip: 172.17.79.217
mac: 00:C0:B7:4D:A4:A3
......@@ -70,14 +70,30 @@ global_hash["sites"].each { |site_uid, site_hash|
# One file for each clusters
site_hash.fetch("clusters").each { |cluster_uid, cluster_hash|
networks = ["eth", "bmc"]
networks << 'mic0' if cluster_hash['nodes'].values.any? {|x| x['network_adapters']['mic0'] }
# networks = ["eth", "bmc"]
# networks << 'mic0' if cluster_hash['nodes'].values.any? {|x| x['network_adapters']['mic0'] }
write_dhcp_file({
"filename" => "cluster-" + cluster_uid + ".conf",
"site_uid" => site_uid,
"nodes" => cluster_hash.fetch('nodes'),
"network_adapters" => networks,
"network_adapters" => ["eth", "bmc", "mic0"],
"optional_network_adapters" => ["mic0"]
})
}
#
#
#
# Other dhcp files
["networks", "laptops", "dom0"].each { |key|
write_dhcp_file({
"filename" => key + ".conf",
"site_uid" => site_uid,
"nodes" => site_hash[key],
"network_adapters" => ["eth", "bmc", "adm"],
"optional_network_adapters" => ["bmc", "adm"]
})
}
......@@ -103,29 +119,4 @@ global_hash["sites"].each { |site_uid, site_hash|
"network_adapters" => ['pdu'],
})
#
#
#
# && node_hash['mic']
# if pdu_hash['ip'] && pdu_hash['mac']
# pdu_hash['network_adapters'] ||= {}
# pdu_hash['network_adapters']['pdu'] ||= {}
# pdu_hash['network_adapters']['pdu']['ip'] = pdu_hash.delete('ip')
# pdu_hash['network_adapters']['pdu']['mac'] = pdu_hash.delete('mac')
# end
# }
next
# Other dhcp files
["networks", "laptops", "dom0"].each { |key|
write_dhcp_file({
"filename" => key + ".conf",
"site_uid" => site_uid,
"nodes" => site_hash['nodes'],
"network_adapters" => ["eth"],
})
}
}
......@@ -10,17 +10,25 @@
group {
<%
data.fetch('nodes').each_sort_by_node_uid { |node_uid, node_hash|
network_interface != 'bmc' ? node_uid_net = node_uid : node_uid_net = node_uid + '-bmc'
next if node_hash['status'] && node_hash['status']['retired']
case network_interface
when 'bmc', 'adm', 'mic0'
node_uid_net = node_uid + '-' + network_interface
else
node_uid_net = node_uid
end
# Get ip and mac addresses
begin
node_ip, node_mac = get_network_info(node_hash, network_interface)
rescue => e
next if data.fetch('optional_network_adapters').include?(network_interface)
# Hash.fetch(key) raise KeyError if the hash[key] does not exist.
puts "Warning: #{site_uid} - #{node_uid}: #{e}. Skip the DHCP entry of the #{network_interface} interface." # (error in #{__method__})
next
end
%>
host <%= node_uid_net %>.<%= site_uid %>.grid5000.fr {
hardware ethernet <%= node_mac.upcase %>;
......
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