Browse Source

Add numa_node info to NIC meta

Get numa_node ID for each NIC, add this info to interface meta and
report it to Nailgun.

Depends-on: I62299123b7ba783544a0b7411d5ee95bcab726f3
Change-Id: Ib75afde70da938fee95822c4575068c74efb8c93
Implements: blueprint support-dpdk
Aleksandr Didenko 3 years ago
parent
commit
70d6c56b2f
1 changed files with 26 additions and 1 deletions
  1. 26
    1
      agent

+ 26
- 1
agent View File

@@ -310,6 +310,15 @@ class NodeAgent
310 310
     ""
311 311
   end
312 312
 
313
+  def nic_numa_node(int_bus_info)
314
+    numa_node = @numa_topology[:numa_nodes].select { |node|
315
+      node[:pcidevs].include?(int_meta[:bus_info])
316
+    }
317
+    numa_node.first[:id].to_i
318
+  rescue
319
+    nil
320
+  end
321
+
313 322
   def _detailed
314 323
     detailed_meta = {
315 324
       :system => _system_info,
@@ -403,6 +412,8 @@ class NodeAgent
403 412
         int_meta[:interface_properties][:sriov] = sriov_info(int, int_meta[:bus_info])
404 413
         # Get PCI-ID
405 414
         int_meta[:interface_properties][:pci_id] = nic_pci_id(int)
415
+        # Get numa node
416
+        int_meta[:interface_properties][:numa_node] = nic_numa_node(int_meta[:bus_info])
406 417
         detailed_meta[:interfaces] << int_meta
407 418
       end
408 419
     rescue Exception => e
@@ -872,6 +883,17 @@ class NodeAgent
872 883
     # <object type="NUMANode" os_index="0" cpuset="0x3ff003ff" complete_cpuset="0x3ff003ff" online_cpuset="0x3ff003ff" allowed_cpuset="0x3ff003ff" nodeset="0x00000001" complete_nodeset="0x00000001" allowed_nodeset="0x00000001" local_memory="67452473344">
873 884
     #   <page_type size="4096" count="14370737"/>
874 885
     #   <page_type size="1073741824" count="8"/>
886
+    # ...
887
+    # <object type="Bridge" os_index="0" bridge_type="0-1" depth="0" bridge_pci="0000:[00-07]">
888
+    #   <object type="Bridge" os_index="51" name="Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 PCI Express Root Port 3" bridge_type="1-1" depth="1" bridge_pci="0000:[04-04]" pci_busid="0000:00:03.3" pci_type="0604 [8086:2f0b] [0000:0000] 02" pci_link_speed="2.000000">
889
+    #     <info name="PCIVendor" value="Intel Corporation"/>
890
+    #     <info name="PCIDevice" value="Xeon E7 v3/Xeon E5 v3/Core i7 PCI Express Root Port 3"/>
891
+    #     <object type="PCIDev" os_index="16384" name="Intel Corporation I350 Gigabit Network Connection" pci_busid="0000:04:00.0" pci_type="0200 [8086:1521] [15d9:1521] 01" pci_link_speed="2.000000">
892
+    #       <info name="PCIVendor" value="Intel Corporation"/>
893
+    #       <info name="PCIDevice" value="I350 Gigabit Network Connection"/>
894
+    #       <object type="OSDev" name="em1" osdev_type="2">
895
+    #         <info name="Address" value="0c:c4:7a:6d:06:c6"/>
896
+
875 897
     doc = Document.new `lstopo --no-caches --of xml`
876 898
 
877 899
     topology = {:numa_nodes => [], :supported_hugepages => supported_hugepages, :distances => nil}
@@ -886,13 +908,16 @@ class NodeAgent
886 908
 
887 909
     doc.elements.each(element) do |numa|
888 910
 
889
-      struct = {:id=> nil, :cpus => [], :memory => nil}
911
+      struct = {:id=> nil, :cpus => [], :memory => nil, :pcidevs => []}
890 912
       struct[:id] = numa.attributes['os_index'].to_i
891 913
       struct[:memory] = numa.attributes['local_memory'].to_i
892 914
 
893 915
       numa.elements.each("object/object/object[@type='PU']") do |pu|
894 916
         struct[:cpus] << pu.attributes['os_index'].to_i
895 917
       end
918
+      numa.elements.each("object/object/object[@type='PCIDev']") do |pcidev|
919
+        struct[:pcidevs] << pcidev.attributes['pci_busid']
920
+      end
896 921
       topology[:numa_nodes] << struct
897 922
     end
898 923
     topology

Loading…
Cancel
Save