Commit 9298831b authored by Jérémie Gaidamour's avatar Jérémie Gaidamour

[all] Renamed a few keys

find . -iname "*.yaml" -exec sed -i 's/block_devices/storage_devices/' {} \;
find . -iname "*.yaml" -exec sed -i 's/network_interfaces/network_adapters/' {} \;
find . -iname "*.yaml" -exec sed -i 's/product_name/name/' {} \;
find . -iname "*.yaml" -exec sed -i 's/serial_number/serial/' {} \;
parent 2439d3eb

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -38,15 +38,15 @@ global_hash["sites"].each { |site_uid, site_hash|
cluster_hash.fetch('nodes').each_sort_by_node_uid { |node_uid, node_hash|
network_interfaces = {}
node_hash.fetch('network_interfaces').each { |net_uid, net_hash|
network_interfaces[net_uid] = {"ip"=>net_hash["ip"], "mounted"=>net_hash["mounted"]}
network_adapters = {}
node_hash.fetch('network_adapters').each { |net_uid, net_hash|
network_adapters[net_uid] = {"ip"=>net_hash["ip"], "mounted"=>net_hash["mounted"]}
}
node_hash.fetch('kavlan').each { |net_uid, ip|
network_interfaces[net_uid] = {"ip"=>ip, "mounted"=>nil}
network_adapters[net_uid] = {"ip"=>ip, "mounted"=>nil}
} if node_hash['kavlan']
network_interfaces.each { |net_uid, net_hash|
network_adapters.each { |net_uid, net_hash|
entries[cluster_uid] = {} unless entries[cluster_uid]
entries[cluster_uid][net_uid] = [] unless entries[cluster_uid][net_uid]
......
......@@ -10,22 +10,22 @@ global_hash = load_yaml_file_hierarchy("../../input/grid5000/")
# Get the mac and ip of a node. Throw exception if error.
def get_network_info(node_hash, network_interface)
# Get node_hash["network_interfaces"][network_interface]["ip"] and node_hash["network_interfaces"][network_interface]["mac"]
node_network_interfaces = node_hash.fetch("network_interfaces")
# Get node_hash["network_adapters"][network_interface]["ip"] and node_hash["network_adapters"][network_interface]["mac"]
node_network_adapters = node_hash.fetch("network_adapters")
# For the production network, find the mounted interface (either eth0 or eth1)
neti = network_interface
if neti == "eth" then
if node_network_interfaces.fetch("eth0").fetch("mounted")
if node_network_adapters.fetch("eth0").fetch("mounted")
neti = "eth0"
elsif node_network_interfaces.fetch("eth1").fetch("mounted")
elsif node_network_adapters.fetch("eth1").fetch("mounted")
neti = "eth1"
else
raise 'neither eth0 nor eth1 have the property "mounted" set to "true"'
end
end
node_network_interface = node_network_interfaces.fetch(neti)
node_network_interface = node_network_adapters.fetch(neti)
raise '"mac" is nil' unless node_mac = node_network_interface.fetch("mac")
raise '"ip" is nil' unless node_ip = node_network_interface.fetch("ip")
......@@ -35,7 +35,7 @@ end
def write_dhcp_file(data)
if data["nodes"].nil?
puts "Error in #{__method__}: no entry for \"#{data['filename']}\" at #{data['site_uid']} (#{data['network_interfaces']})."
puts "Error in #{__method__}: no entry for \"#{data['filename']}\" at #{data['site_uid']} (#{data['network_adapters']})."
return ""
end
......@@ -61,7 +61,7 @@ global_hash["sites"].each { |site_uid, site_hash|
"filename" => "cluster-" + cluster_uid + ".conf",
"site_uid" => site_uid,
"nodes" => cluster_hash.fetch('nodes'),
"network_interfaces" => ["eth", "bmc"],
"network_adapters" => ["eth", "bmc"],
})
}
......@@ -71,7 +71,7 @@ global_hash["sites"].each { |site_uid, site_hash|
"filename" => key + ".conf",
"site_uid" => site_uid,
"nodes" => site_hash['nodes'],
"network_interfaces" => ["eth"],
"network_adapters" => ["eth"],
})
}
......
......@@ -5,7 +5,7 @@
<%
site_uid = data.fetch('site_uid')
data.fetch('network_interfaces').each { |network_interface|
data.fetch('network_adapters').each { |network_interface|
%>
group {
<%
......
......@@ -24,8 +24,8 @@ def get_node_properties(cluster_uid, cluster, node_uid, node)
return h if node.size == 1 # for dead nodes, additional information is most likely missing from the ref-repository.
end
main_network_adapter = node['network_interfaces'].values.find{ |na| na['enabled'] && na['mounted'] && na['interface'] =~ /ethernet/i && !na['management'] }
main_network_adapter = node['network_interfaces'].values.find{ |na| na['enabled'] && na['mounted'] }
main_network_adapter = node['network_adapters'].values.find{ |na| na['enabled'] && na['mounted'] && na['interface'] =~ /ethernet/i && !na['management'] }
main_network_adapter = node['network_adapters'].values.find{ |na| na['enabled'] && na['mounted'] }
raise MissingProperty, "Node #{node_uid} does not have a main network_adapter" unless main_network_adapter
# h['host'] = main_network_adapter['network_address']
......@@ -45,32 +45,32 @@ def get_node_properties(cluster_uid, cluster, node_uid, node)
h['cputype'] = [node['processor']['model'], node['processor']['version']].join(' ')
h['cpufreq'] = node['processor']['clock_speed']/1_000_000_000.0
h['disktype'] = (node['block_devices'].first[1] || {})['interface']
h['ethnb'] = node['network_interfaces'].values.select{|na| na['interface'] =~ /ethernet/i}.select{|nb| nb['mounted'] == true || nb['mountable'] == true}.length
h['ethnb'] = node['network_adapters'].values.select{|na| na['interface'] =~ /ethernet/i}.select{|nb| nb['mounted'] == true || nb['mountable'] == true}.length
eth10g = node['network_interfaces'].values.select{|na| na['interface'] =~ /ethernet/i}.select{|nb| nb['mounted'] == true || nb['mountable'] == true}
eth10g = node['network_adapters'].values.select{|na| na['interface'] =~ /ethernet/i}.select{|nb| nb['mounted'] == true || nb['mountable'] == true}
h['eth10g'] = eth10g.detect{|na| na['rate'] == 10_000_000_000}.nil? ? false : true
ib10g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /infiniband/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 10_000_000_000}
ib10g = node['network_adapters'].values.detect{|na| na['interface'] =~ /infiniband/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 10_000_000_000}
h['ib10g'] = ib10g ? true : false
h['ib10gmodel'] = ib10g ? ib10g['version'] : 'none'
ib20g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /infiniband/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 20_000_000_000}
ib20g = node['network_adapters'].values.detect{|na| na['interface'] =~ /infiniband/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 20_000_000_000}
h['ib20g'] = ib20g ? true : false
h['ib20gmodel'] = ib20g ? ib20g['version'] : 'none'
ib40g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /infiniband/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 40_000_000_000}
ib40g = node['network_adapters'].values.detect{|na| na['interface'] =~ /infiniband/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 40_000_000_000}
h['ib40g'] = ib40g ? true : false
h['ib40gmodel'] = ib40g ? ib40g['version'] : 'none'
ib56g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /infiniband/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 56_000_000_000}
ib56g = node['network_adapters'].values.detect{|na| na['interface'] =~ /infiniband/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 56_000_000_000}
h['ib56g'] = ib56g ? true : false
h['ib56gmodel'] = ib56g ? ib56g['version'] : 'none'
myri10g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /myri/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 10_000_000_000}
myri10g = node['network_adapters'].values.detect{|na| na['interface'] =~ /myri/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 10_000_000_000}
h['myri10g'] = myri10g ? true : false
h['myri10gmodel'] = myri10g ? myri10g['version'] : 'none'
myri2g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /myri/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 2_000_000_000}
myri2g = node['network_adapters'].values.detect{|na| na['interface'] =~ /myri/i && ( na['mounted'] == true || na['mountable'] == true ) && na['rate'] == 2_000_000_000}
h['myri2g'] = myri2g ? true : false
h['myri2gmodel'] = myri2g ? myri2g['version'] : 'none'
......
......@@ -110,14 +110,6 @@ global_hash["sites"].each do |site_uid, site|
node["monitoring"] = {} unless node.key?("monitoring")
node["monitoring"]["wattmeter"] = false unless node["monitoring"].key?("wattmeter")
# Rename keys
node["storage_devices"] = node.delete("block_devices")
node["network_adapters"] = node.delete("network_interfaces")
if node.key?("chassis")
node["chassis"]["name"] = node["chassis"].delete("product_name")
node["chassis"]["serial"] = node["chassis"].delete("serial_number")
end
# Delete keys
node["storage_devices"].keys.each { |key|
node["storage_devices"][key].delete("timeread") if node["storage_devices"][key].key?("timeread")
......
......@@ -4,7 +4,7 @@ pomme-1:
version: V1.35.2.2
release_date: 04/25/2006
vendor: Phoenix Technologies Ltd.
network_interfaces:
network_adapters:
eth0:
mounted: false
mac: 00:09:3d:12:9e:13
......