diff --git a/input/grid5000/ipv4.yaml b/input/grid5000/ipv4.yaml index 548945688160dcffdab884e9a8e1632e565e14dd..eb26d24b2c4e40ce1222c04a54a58b82c0f0db2c 100644 --- a/input/grid5000/ipv4.yaml +++ b/input/grid5000/ipv4.yaml @@ -15,12 +15,16 @@ ipv4: louvain 0 0 208 0 iface_offsets: |- grenoble yeti eth0 0 0 3 0 + grenoble yeti ib0 0 0 3 0 grenoble dahu eth0 0 0 4 0 + grenoble dahu ib0 0 0 4 0 grenoble troll eth0 0 0 6 0 + grenoble troll ib0 0 0 5 0 grenoble servan eth0 0 0 7 0 grenoble servan fpga0 0 0 7 10 grenoble servan fpga1 0 0 7 20 grenoble drac eth0 0 0 8 0 + grenoble drac ib0 0 0 8 0 grenoble nessie eth0 0 0 9 0 lille chifflot eth0 0 0 4 0 lille chifflot eth1 0 0 4 100 @@ -41,6 +45,7 @@ ipv4: lyon pyxis eth0 0 0 6 0 lyon neowise eth0 0 0 7 0 lyon neowise eth1 0 0 7 10 + lyon neowise ib0 0 0 7 0 lyon sirius eth0 0 0 8 0 lyon hydra eth0 0 0 9 0 lyon hydra eth1 0 0 9 4 @@ -48,8 +53,10 @@ ipv4: nancy gros eth0 0 0 2 0 nancy gros eth1 0 0 2 128 nancy grele eth0 0 0 10 0 + nancy grele ib0 0 0 10 0 nancy gratouille eth0 0 0 10 14 nancy grvingt eth0 0 0 12 0 + nancy grvingt ib0 0 0 12 0 nancy grue eth0 0 0 13 0 nancy grappe eth0 0 0 14 0 nancy grouille eth2 0 0 15 0 @@ -59,6 +66,7 @@ ipv4: nancy grostiti eth0 0 0 5 12 nancy gres eth0 0 0 1 0 nancy grdix eth0 0 0 1 10 + nancy grdix ibs1 0 0 13 0 nantes econome eth0 0 0 0 0 nantes ecotype eth0 0 0 1 0 nantes ecotype eth1 0 0 2 0 @@ -102,6 +110,9 @@ ipv4: rennes roazhon11 eth0 0 0 14 36 rennes roazhon12 eth0 0 0 14 39 rennes roazhon13 eth0 0 0 14 44 + sophia uvb eth0 0 0 4 0 + sophia uvb ib0 0 0 4 0 + sophia esterel31 eth0 0 0 3 40 sophia mercantour1 eth0 0 0 2 0 sophia mercantour2 eth0 0 0 2 16 sophia mercantour2 ib0 0 0 2 16 @@ -151,6 +162,7 @@ ipv4: sophia esterel39 eth0 0 0 3 52 sophia esterel40 eth0 0 0 3 53 sophia esterel41 eth0 0 0 3 55 + sophia esterel41 ibs3 0 0 3 55 sophia musa eth0 0 0 5 0 sophia uvb eth0 0 0 4 0 strasbourg fleckenstein eth0 0 0 0 0 diff --git a/lib/refrepo/input_loader.rb b/lib/refrepo/input_loader.rb index 8b29a8b79fa3b673498bd77b57b48588db0bf18e..463a11655ce1dba20eeaaca2b19fdafeaaa5f364 100644 --- a/lib/refrepo/input_loader.rb +++ b/lib/refrepo/input_loader.rb @@ -454,6 +454,7 @@ def add_kavlan_ips(h) end BMC_OFFSET=256**2 +IB_OFFSET=(256**2)*2 def add_ipv4(h) allocated = {} @@ -463,26 +464,36 @@ def add_ipv4(h) h['sites'].each_pair do |site_uid, hs| hs.fetch('clusters', {}).each_pair do |cluster_uid, hc| hc['nodes'].each_pair do |node_uid, hn| + # We don't generate JSON for retired nodes + next if hn['status'] == 'retired' raise "Node hash for #{node_uid} is nil" if hn.nil? node_id = node_uid.split('-')[1].to_i hn['network_adapters'].each_pair do |iface, v| - # only allocate mountable ethernet interfaces and BMC - next if not ((v['mountable'] or v['management']) and ['Ethernet','FPGA/Ethernet'].include?(v['interface'])) + # We only consider interfaces that are either mountable, or management (BMC) + next if not (v['mountable'] or v['management']) if iface == 'bmc' - # We pick up the mounted Ethernet interface and add an offset + # We get the iface offset for BMC by adding the BMC_OFFSET to the iface_offset of the first prod interface prod_name = hn['network_adapters'].to_a.select { |e| e[1]['mounted'] and e[1]['interface'] == 'Ethernet' }.first[0] k = [site_uid, cluster_uid, prod_name] + if_kind_offset = BMC_OFFSET + elsif ['InfiniBand', 'Omni-Path'].include?(v['interface']) + # HPC interface can be defined inside the node-X.yaml file or generated from ipv4.yaml + next if not v['netmask'] # if there's no 'netmask' entry, we assume that we don't want IPoIB, so no IP (g5k-postinstall won't configure it anyway) + k = [site_uid, cluster_uid, iface] if not iface_offsets.has_key?(k) - raise "Missing IPv4 information for #{k}" + puts "Warning: #{iface} offset should be defined for cluster #{cluster_uid} in ipv4.yaml" + next end - ip = IPAddress::IPv4::parse_u32(base + sites_offsets[site_uid] + iface_offsets[k] + node_id + BMC_OFFSET).to_s + if_kind_offset = IB_OFFSET else + # Ethernet interfaces must have an IP defined in ipv4.yaml k = [site_uid, cluster_uid, iface] - if not iface_offsets.has_key?(k) - raise "Missing IPv4 information for #{k}" - end - ip = IPAddress::IPv4::parse_u32(base + sites_offsets[site_uid] + iface_offsets[k] + node_id).to_s + if_kind_offset = 0 + end + if not iface_offsets.has_key?(k) + raise "Missing IPv4 information for #{k}" end + ip = IPAddress::IPv4::parse_u32(base + sites_offsets[site_uid] + iface_offsets[k] + node_id + if_kind_offset).to_s a = [ site_uid, node_uid, iface ] raise "IP already allocated: #{ip} (trying to add it to #{a} ; allocated to #{allocated[ip]})" if allocated[ip] allocated[ip] = a