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

[dev] Fixed IB properties

parent f1a98eb8
...@@ -43,27 +43,27 @@ def get_node_properties(cluster_uid, cluster, node_uid, node) ...@@ -43,27 +43,27 @@ def get_node_properties(cluster_uid, cluster, node_uid, node)
eth10g = node['network_interfaces'].values.select{|na| na['interface'] =~ /ethernet/i}.select{|nb| nb['mountable'] == true} eth10g = node['network_interfaces'].values.select{|na| na['interface'] =~ /ethernet/i}.select{|nb| nb['mountable'] == true}
h['eth10g'] = eth10g.detect{|na| na['rate'] == 10_000_000_000}.nil? ? false : 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['rate'] == 10_000_000_000} ib10g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /infiniband/i && na['mountable'] == true && na['rate'] == 10_000_000_000}
h['ib10g'] = ib10g ? true : false h['ib10g'] = ib10g ? true : false
h['ib10gmodel'] = ib10g ? ib10g['version'] : 'none' h['ib10gmodel'] = ib10g ? ib10g['version'] : 'none'
ib20g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /infiniband/i && na['rate'] == 20_000_000_000} ib20g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /infiniband/i && na['mountable'] == true && na['rate'] == 20_000_000_000}
h['ib20g'] = ib20g ? true : false h['ib20g'] = ib20g ? true : false
h['ib20gmodel'] = ib20g ? ib20g['version'] : 'none' h['ib20gmodel'] = ib20g ? ib20g['version'] : 'none'
ib40g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /infiniband/i && na['rate'] == 40_000_000_000} ib40g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /infiniband/i && na['mountable'] == true && na['rate'] == 40_000_000_000}
h['ib40g'] = ib40g ? true : false h['ib40g'] = ib40g ? true : false
h['ib40gmodel'] = ib40g ? ib40g['version'] : 'none' h['ib40gmodel'] = ib40g ? ib40g['version'] : 'none'
ib56g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /infiniband/i && na['rate'] == 56_000_000_000} ib56g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /infiniband/i && na['mountable'] == true && na['rate'] == 56_000_000_000}
h['ib56g'] = ib56g ? true : false h['ib56g'] = ib56g ? true : false
h['ib56gmodel'] = ib56g ? ib56g['version'] : 'none' h['ib56gmodel'] = ib56g ? ib56g['version'] : 'none'
myri10g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /myri/i && na['rate'] == 10_000_000_000} myri10g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /myri/i && na['mountable'] == true && na['rate'] == 10_000_000_000}
h['myri10g'] = myri10g ? true : false h['myri10g'] = myri10g ? true : false
h['myri10gmodel'] = myri10g ? myri10g['version'] : 'none' h['myri10gmodel'] = myri10g ? myri10g['version'] : 'none'
myri2g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /myri/i && na['rate'] == 2_000_000_000} myri2g = node['network_interfaces'].values.detect{|na| na['interface'] =~ /myri/i && na['mountable'] == true && na['rate'] == 2_000_000_000}
h['myri2g'] = myri2g ? true : false h['myri2g'] = myri2g ? true : false
h['myri2gmodel'] = myri2g ? myri2g['version'] : 'none' h['myri2gmodel'] = myri2g ? myri2g['version'] : 'none'
......
...@@ -178,9 +178,9 @@ if options[:output] ...@@ -178,9 +178,9 @@ if options[:output]
nodelist_properties[opt].each { |site_uid, site_properties| nodelist_properties[opt].each { |site_uid, site_properties|
options[:output].is_a?(String) ? o = File.open(options[:output].gsub("%s", site_uid),'w') : o = $stdout.dup options[:output].is_a?(String) ? o = File.open(options[:output].gsub("%s", site_uid),'w') : o = $stdout.dup
site_properties.each_filtered_node_uid(options[:clusters], options[:nodes]) { |node_uid, node_properties| site_properties.each_filtered_node_uid(options[:clusters], options[:nodes]) { |node_uid, node_properties|
o.write(oarcmd_set_node_properties(node_uid, node_properties) + "\n") o.write(oarcmd_set_node_properties(node_uid + "." + site_uid + ".grid5000.fr", node_properties) + "\n")
} }
o.close o.close
...@@ -192,6 +192,10 @@ end ...@@ -192,6 +192,10 @@ end
# Execute commands # Execute commands
# #
if options[:exec] if options[:exec]
printf "Apply changes to the OAR servers ? (y/n)"
prompt = STDIN.gets.chomp
exit unless prompt == 'y'
opt = options[:diff] ? 'diff' : 'ref' opt = options[:diff] ? 'diff' : 'ref'
nodelist_properties[opt].each { |site_uid, site_properties| nodelist_properties[opt].each { |site_uid, site_properties|
...@@ -199,11 +203,11 @@ if options[:exec] ...@@ -199,11 +203,11 @@ if options[:exec]
Net::SSH.start("oar.#{site_uid}.g5kadmin", 'g5kadmin', :keys => options[:sshkeys]) { |ssh| Net::SSH.start("oar.#{site_uid}.g5kadmin", 'g5kadmin', :keys => options[:sshkeys]) { |ssh|
site_properties.each_filtered_node_uid(options[:clusters], options[:nodes]) { |node_uid, node_properties| site_properties.each_filtered_node_uid(options[:clusters], options[:nodes]) { |node_uid, node_properties|
cmd = oarcmd_set_node_properties(node_uid, node_properties) cmd = oarcmd_set_node_properties(node_uid + "." + site_uid + ".grid5000.fr", node_properties)
if cmd.size>0 if cmd.size>0
puts "#{cmd}" if options[:verbose] puts "#{cmd}" if options[:verbose]
ssh_output = ssh.exec!('echo ' + cmd) ssh_output = ssh.exec!('sudo ' + cmd)
puts "#{ssh_output}" if options[:verbose] puts "#{ssh_output}\n" if options[:verbose]
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