diff --git a/Rakefile b/Rakefile index 4d9940264d6740c0fd49025baa8a341026c275d0..e3fd504703b23a83e5cba1f347bd7b37fb1e9d5e 100644 --- a/Rakefile +++ b/Rakefile @@ -54,7 +54,8 @@ namespace :g5k do command = File.join(ROOT_DIR, "generators", "grid5000") command += " " + File.join(root_dir_input, site,"#{site}.rb") command += " " + File.join(root_dir_input, site,"clusters","#{host}.rb") - command += " " + File.join(root_dir_input, site,"clusters","#{host}.yaml") + command += " " + File.join(root_dir_input, site,"clusters","#{host}_generated.yaml") + command += " " + File.join(root_dir_input, site,"clusters","#{host}_manual.yaml") command += " " + File.join(root_dir_input, site,"pdus.rb") command << " -s" if ENV['DRY'] == "yes" @@ -153,7 +154,7 @@ namespace :oar do next end - command = "oaradmin resources" + command = "" case action when "A", "C", "M" @@ -168,28 +169,39 @@ namespace :oar do next end if action == "M" # modification of a file - command.concat(" -s node=#{host} ") + command.concat("oarnodesetting -h #{host} ") + command.concat(" -p ").concat( export.to_a.map{|(k,v)| + if v.nil? + nil + else + "#{k}=#{v.inspect.gsub("'", "\\'").gsub("\"", "'")}" + end + }.compact.join(" -p ") ) else # new file - command.concat(" -a /node=#{host}/cpu={#{node.properties['architecture']['smp_size']}}/core={#{export['cpucore']}}") - command.concat(" --auto-offset") + node_number = node_uid.split("-")[1] + command.concat("oar_resources_add -H 1 --host0 #{node_number} --host-prefix #{cluster_uid}- --host-suffix .#{site_uid}.#{grid_uid}.fr -C #{node.properties['architecture']['smp_size']} -c #{export['cpucore']}") + command.concat(" -a") + # Add other properties + command.concat(' -A "') if ENV['MAINTENANCE'] && ENV['MAINTENANCE']=='NO' - command.concat(' -p maintenance="NO"') + command.concat(' -p maintenance=\'NO\'') else # by default, maintenance is YES when creating new resources - command.concat(' -p maintenance="YES"') + command.concat(' -p maintenance=\'YES\'') end # by default, an Alive node has comment "OK" - command.concat(' -p comment="OK"') + command.concat(' -p comment=\'OK\'') + command.concat(" -p ").concat( export.to_a.map{|(k,v)| + if v.nil? + nil + else + "#{k}=#{v.inspect.gsub("'", "\\'").gsub("\"", "'")}" + end + }.compact.join(" -p ") ) + command.concat('"') end - command.concat(" -p ").concat( export.to_a.map{|(k,v)| - if v.nil? - nil - else - [k, v.inspect].join("=") - end - }.compact.join(" -p ") ) when "D" # deletion of a file - command.concat(" -d node=#{host}") + command.concat("oarnodesetting -s Dead -h #{host}") else @logger.warn "Don't know what to do with #{line.inspect}. Ignoring." next @@ -264,4 +276,3 @@ namespace :weathermap do Rake::Task['weathermap:execute'].invoke end end - diff --git a/generators/lib/grid5000/node.rb b/generators/lib/grid5000/node.rb index e3f7249cc4af6da905fc137c34340e11b6c6ca49..e39a1229fea4dc1b3f9235d93234cb48872dca40 100644 --- a/generators/lib/grid5000/node.rb +++ b/generators/lib/grid5000/node.rb @@ -21,14 +21,14 @@ module Grid5000 h['cluster'] = cluster.properties['uid'] h['nodemodel'] = cluster.properties['model'] h['switch'] = main_network_adapter['switch'] - #h['besteffort'] = properties['supported_job_types']['besteffort'] ? "YES" : "NO" - #h['deploy'] = properties['supported_job_types']['deploy'] ? "YES" : "NO" + h['besteffort'] = properties['supported_job_types']['besteffort'] ? "YES" : "NO" + h['deploy'] = properties['supported_job_types']['deploy'] ? "YES" : "NO" h['ip_virtual'] = properties['supported_job_types']['virtual'] ? "YES" : "NO" h['virtual'] = properties['supported_job_types']['virtual'] h['cpuarch'] = properties['architecture']['platform_type'] h['cpucore'] = properties['architecture']['smt_size']/properties['architecture']['smp_size'] h['cputype'] = [properties['processor']['model'], properties['processor']['version']].join(" ") - h['cpufreq'] = properties['processor']['clock_speed']/1_000_000_000 + h['cpufreq'] = properties['processor']['clock_speed']/1_000_000_000.0 h['disktype'] = (properties['storage_devices'].first || {})['interface'] h['ethnb'] = properties["network_adapters"].select{|na| na['interface'] =~ /ethernet/i}.select{|nb| nb['mountable'] == true}.length ib10g = properties['network_adapters'].detect{|na| na['interface'] =~ /infiniband/i && na['rate'] == 10_000_000_000}