Browse Source

Getting numanode from all possible structure

  - Setup xpath to getting NUMANode

Closes-Bug: #1552342

Change-Id: I01361093edd816d210774b1ea9f98c32d4250c4f
Ivan Ponomarev 3 years ago
parent
commit
3d46f10a74
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      agent

+ 5
- 5
agent View File

@@ -898,13 +898,13 @@ class NodeAgent
898 898
 
899 899
     topology = {:numa_nodes => [], :supported_hugepages => supported_hugepages, :distances => nil}
900 900
 
901
-    doc.elements.each('/topology/object/distances/') do |dist|
901
+    doc.elements.each('//distances/') do |dist|
902 902
       topology[:distances] = dist.elements.collect{|v| v.attributes['value']}
903 903
         .each_slice(dist.attributes['nbobjs'].to_i).to_a
904 904
     end
905 905
 
906
-    numa_node = "/topology/object/object[@type='NUMANode']"
907
-    element = doc.elements[numa_node] ? numa_node : "/topology/object[@type='Machine']"
906
+    numa_node = "//object[@type='NUMANode']"
907
+    element = doc.elements["//object[@type='NUMANode']"] ? numa_node : "//object[@type='Machine']"
908 908
 
909 909
     doc.elements.each(element) do |numa|
910 910
 
@@ -912,10 +912,10 @@ class NodeAgent
912 912
       struct[:id] = numa.attributes['os_index'].to_i
913 913
       struct[:memory] = numa.attributes['local_memory'].to_i
914 914
 
915
-      numa.elements.each("object/object/object[@type='PU']") do |pu|
915
+      numa.elements.each("#{numa.xpath}//[@type='PU']") do |pu|
916 916
         struct[:cpus] << pu.attributes['os_index'].to_i
917 917
       end
918
-      numa.elements.each("object/object/object[@type='PCIDev']") do |pcidev|
918
+      numa.elements.each("#{numa.xpath}//[@type='PCIDev']") do |pcidev|
919 919
         struct[:pcidevs] << pcidev.attributes['pci_busid']
920 920
       end
921 921
       topology[:numa_nodes] << struct

Loading…
Cancel
Save