summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandr Didenko <adidenko@mirantis.com>2016-02-18 14:03:54 +0100
committerAleksandr Didenko <adidenko@mirantis.com>2016-03-02 09:02:55 +0100
commit5433c081ea70ca5d59a99579155db6dd0d07078e (patch)
tree536064ab43a9216215b346d4290d411e1053836f
parent01ec3c5501c4275063e81323116d4b65893a220f (diff)
Add PCI-ID to NIC metadata
Get PCI-ID infromation for NIC via sysfs and report it to nailgun. Implements: blueprint support-dpdk Change-Id: I7a6187be1e35e428f7d868584d2c1d4a8686b0bd
Notes
Notes (review): Verified+1: Fuel CI <fuel-ci-bot@mirantis.com> Code-Review+1: Michael Polenchuk <mpolenchuk@mirantis.com> Code-Review+1: Biswajeeban Mishra <mishra@inf.u-szeged.hu> Code-Review+2: Vladimir Sharshov <vsharshov@mirantis.com> Workflow+1: Vladimir Sharshov <vsharshov@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 03 Mar 2016 01:46:30 +0000 Reviewed-on: https://review.openstack.org/281827 Project: openstack/fuel-nailgun-agent Branch: refs/heads/master
-rwxr-xr-xagent10
1 files changed, 10 insertions, 0 deletions
diff --git a/agent b/agent
index d624d0a..306920a 100755
--- a/agent
+++ b/agent
@@ -302,6 +302,14 @@ class NodeAgent
302 DEFAULT_SRIOV 302 DEFAULT_SRIOV
303 end 303 end
304 304
305 def nic_pci_id(int)
306 vendor = File.read("/sys/class/net/#{int}/device/vendor").chomp.gsub(/^0x/, '')
307 device = File.read("/sys/class/net/#{int}/device/device").chomp.gsub(/^0x/, '')
308 "#{vendor}:#{device}"
309 rescue
310 ""
311 end
312
305 def _detailed 313 def _detailed
306 detailed_meta = { 314 detailed_meta = {
307 :system => _system_info, 315 :system => _system_info,
@@ -393,6 +401,8 @@ class NodeAgent
393 end 401 end
394 # Getting SR-IOV info 402 # Getting SR-IOV info
395 int_meta[:interface_properties][:sriov] = sriov_info(int, int_meta[:bus_info]) 403 int_meta[:interface_properties][:sriov] = sriov_info(int, int_meta[:bus_info])
404 # Get PCI-ID
405 int_meta[:interface_properties][:pci_id] = nic_pci_id(int)
396 detailed_meta[:interfaces] << int_meta 406 detailed_meta[:interfaces] << int_meta
397 end 407 end
398 rescue Exception => e 408 rescue Exception => e