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

[dev] conmang5k generator

parent 391ed05b
......@@ -75,6 +75,9 @@ nodes:
gpu_count: 2
gpu_vendor: Nvidia
gpu_model: Tesla-C1060
conman:
device: ipmi
workaround_flag: solpayloadsize
adonis-1:
chassis:
......
......@@ -94,8 +94,9 @@ nodes:
version: "1.7"
gpu:
gpu: false
conman:
device: ipmi
workaround_flag: solpayloadsize
edel-10:
chassis:
......
......@@ -60,3 +60,6 @@ nodes:
gpu: false
monitoring:
wattmeter: false
conman:
device: ipmi
workaround_flag: solpayloadsize
......@@ -73,6 +73,8 @@ nodes:
gpu: false
monitoring:
wattmeter: false
conman:
device: /usr/lib/conman/exec/ipmiconsole.exp
chimint-1:
chassis:
......
......@@ -56,3 +56,5 @@ nodes:
gpu: false
monitoring:
wattmeter: false
conman:
device: /usr/lib/conman/exec/ipmiconsole.exp
......@@ -79,10 +79,10 @@ nodes:
gpu_count: 4
gpu_vendor: Nvidia
gpu_model: Tesla-S2050
monitoring:
wattmeter: false
conman:
device: /usr/lib/conman/exec/ipmiconsole.exp
chirloute-6:
chassis:
......
......@@ -74,6 +74,8 @@ nodes:
metric: power
www:
url: http://wattmetre.lyon.grid5000.fr/GetWatts-json.php
conman:
device: /usr/lib/conman/exec/sun-v20z-v40z.exp
sagittaire-[70-79]:
storage_devices:
......
......@@ -82,7 +82,8 @@ nodes:
sensors:
power:
available: false
conman:
device: /usr/lib/conman/exec/ipmiconsole.exp
econome-1:
chassis:
......
......@@ -73,6 +73,8 @@ nodes:
mounted: false
gpu:
gpu: false
conman:
device: /usr/lib/conman/exec/ipmiconsole.exp
stremi-1:
chassis:
......
......@@ -99,6 +99,8 @@ nodes:
sensors:
power:
available: false
conman:
device: /usr/lib/conman/exec/ipmiconsole.exp
paranoia-1:
chassis:
......
......@@ -101,7 +101,8 @@ nodes:
management: true
gpu:
gpu: false
conman:
device: /usr/lib/conman/exec/sun-ilom.exp
parapide-1:
chassis:
......
......@@ -104,6 +104,8 @@ nodes:
ipmi:
sensors:
ambient: Inlet Ambient
conman:
device: /usr/lib/conman/exec/ipmiconsole.exp
parapluie-1:
chassis:
......
......@@ -62,3 +62,8 @@ kavlans:
16:
network: 10.27.192.0/18
gateway: 10.27.255.254
servers:
ceph[0-3]:
conman:
device: /usr/lib/conman/exec/ipmiconsole.exp
......@@ -44,6 +44,8 @@ nodes:
gpu: false
monitoring:
wattmeter: false
conman:
device: /usr/lib/conman/exec/sun-elom.exp
sol-[1-28]:
network_adapters:
......
......@@ -72,6 +72,8 @@ nodes:
gpu: false
monitoring:
wattmeter: false
conman:
device: /usr/lib/conman/exec/ipmiconsole.exp
suno-11:
chassis:
......
#!/usr/bin/ruby
require 'pp'
require 'erb'
require 'fileutils'
require '../lib/input_loader'
require '../lib/hash/hash.rb'
global_hash = load_yaml_file_hierarchy("../input/grid5000/")
passwd_hash = YAML::load_file('./conman-password.yaml')
passwd_hash = passwd_hash.expand_square_brackets()
def write_conman_file(site_uid, site, passwd)
erb = ERB.new(File.read("templates/conman.erb"))
output_file = File.join('output', 'conmang5k', 'files', site_uid, 'conman.conf')
# Create directory hierarchy
dirname = File.dirname(output_file)
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
# Apply ERB template and save
File.open(output_file, "w+") { |f|
f.write(erb.result(binding))
}
end
# Loop over Grid'5000 sites
global_hash["sites"].each { |site_uid, site|
write_conman_file(site_uid, site, passwd_hash[site_uid])
}
server logfile="/var/log/conman.log"
<%
# http://conman.googlecode.com/svn/trunk/etc/conman.conf
# Input data:
#
# node_uid:
# network_adapters:
# bmc:
# network_address: node_uid-bmc.site.grid5000.fr
# conman:
# device: /usr/lib/conman/exec/ipmitool.exp
# or
# conman:
# device: ipmi
# workaround_flag: solpayloadsize
[site['clusters'], { 'servers' => { 'nodes' => site['servers'] || {} } }].each { |clusters|
clusters.each { |cluster_uid, cluster|
cluster['nodes'].each_sort_by_node_uid { |node_uid, node|
cluster_uid = /[A-Za-z]*/.match(node_uid).to_s if cluster_uid == 'servers' # deduce cluster_uid from node_uid for 'servers' entries
password = passwd[node_uid] || passwd[cluster_uid] # this allows setting password on a cluster or node basis
put "#{node_uid}; password not found" unless passwd
bmc = node['network_adapters']['bmc'].fetch('network_address').split('.')[0] rescue node_uid + '-bmc'
dev = node['conman'].fetch('device') rescue '/usr/lib/conman/exec/ipmitool.exp'
if dev != 'ipmi'
# External process-based connection (default)
# Example : console name="node_uid" dev="/usr/lib/conman/exec/ipmitool.exp node_uid-bmc login password"
dev_args = "#{bmc} #{password}"
else
# IPMI Serial-Over-LAN connection
# Example : console name="node_uid" dev="ipmi:node_uid-bmc" ipmiopts="U:login,P:password,W:workaround_flag"
dev = "#{dev}:#{bmc}"
login, pass = password.split(' ')
ipmiopts = "U:#{login},P:#{pass}"
ipmiopts += ",W:#{node['conman'].fetch('workaround_flag')}" rescue ''
end
%>console name="<%= node_uid %>" dev="<%= dev %><%= " #{dev_args}" if dev_args %>"<%= " ipmiopts=\"#{ipmiopts}\"" if ipmiopts %>
<% } %>
<% } %>
<% } %>
......@@ -71,7 +71,7 @@ global_hash["sites"].each do |site_uid, site|
site_path.mkpath()
write_json(site_path.join("#{site_uid}.json"),
site.reject {|k, v| k == "clusters" || k == "networks" || k == "pdu" || k == "dom0" || k == "laptops"})
site.reject {|k, v| k == "clusters" || k == "networks" || k == "pdu" || k == "dom0" || k == "laptops" || k == "servers" })
#
# Write pdu info
......@@ -247,8 +247,9 @@ global_hash["sites"].each do |site_uid, site|
node.delete("kavlan")
#pp cluster_path.join("nodes","#{node_uid}.json")
write_json(cluster_path.join("nodes","#{node_uid}.json"), node)
write_json(cluster_path.join("nodes","#{node_uid}.json"),
node.reject {|k, v| k == "conman"})
end
end
end
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