fuel-nailgun-agent: ohai: Read L1 info w/ ethtool.
[armband.git] / patches / fuel-nailgun-agent / 0001-ohai-Support-reading-L1-info-from-ethtool.patch
1 From: Enea Armband Devops Team <armband@enea.com>
2 Date: Sat, 2 Apr 2016 22:57:59 +0200
3 Subject: [PATCH] ohai: Support reading L1 info from ethtool.
4
5 Traditional methods of reading the ethernet card speed rely on the
6 drivers populating the advertised and/or supported link speed lists.
7
8 This is not true for all drivers, especially for some Fibers
9 that only report the speed via ethtool when the link is up.
10
11 This patch adds support for reading L1 info from ohai, which
12 supports parsing ethtool speed starting with version amos2 [1].
13
14 [1] https://linux.enea.com/mos-repos/ubuntu/8.0/pool/main/o/
15     ohai/ohai_6.14.0-2~u14.04+mos1+mos8.0+amos2_all.deb
16 ---
17  ...ohai-Support-reading-L1-info-from-ethtool.patch | 34 ++++++++++++++++++++++
18  debian/patches/series                              |  1 +
19  2 files changed, 35 insertions(+)
20  create mode 100644 debian/patches/0001-ohai-Support-reading-L1-info-from-ethtool.patch
21  create mode 100644 debian/patches/series
22
23 diff --git a/debian/patches/0001-ohai-Support-reading-L1-info-from-ethtool.patch b/debian/patches/0001-ohai-Support-reading-L1-info-from-ethtool.patch
24 new file mode 100644
25 index 0000000..aa50ea4
26 --- /dev/null
27 +++ b/debian/patches/0001-ohai-Support-reading-L1-info-from-ethtool.patch
28 @@ -0,0 +1,34 @@
29 +From 942c67f74c00b1097d1ad27ece79fe91b475190c Mon Sep 17 00:00:00 2001
30 +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
31 +Date: Sat, 2 Apr 2016 22:54:27 +0200
32 +Subject: [PATCH] ohai: Support reading L1 info from ethtool.
33 +
34 +Upstream ohai [1] introduces support for reading layer one information
35 +from ethtool. Allow nailgun-agent to use that info if present.
36 +
37 +[1] https://github.com/chef/ohai/commit/
38 +    afd42e9122f057ab00dd24357c28dc2ad6806434
39 +---
40 + agent | 6 +++++-
41 + 1 file changed, 5 insertions(+), 1 deletion(-)
42 +
43 +diff --git a/agent b/agent
44 +index c764a68..978131f 100755
45 +--- a/agent
46 ++++ b/agent
47 +@@ -316,7 +316,11 @@ class NodeAgent
48 +                 int_meta[:current_speed] = int_info.current_mode.speed
49 +               end
50 +             rescue
51 +-              int_meta[:current_speed] = nil
52 ++              if intinfo.has_key?(:link_speed) && 0 < intinfo[:link_speed]
53 ++                int_meta[:current_speed] = intinfo[:link_speed]
54 ++              else
55 ++                int_meta[:current_speed] = nil
56 ++              end
57 +             end
58 +           elsif (addrinfo[:family] rescue nil) =~ /^inet$/
59 +             int_meta[:ip] = addr
60 +--
61 +1.9.1
62 +
63 diff --git a/debian/patches/series b/debian/patches/series
64 new file mode 100644
65 index 0000000..b221a98
66 --- /dev/null
67 +++ b/debian/patches/series
68 @@ -0,0 +1 @@
69 +0001-ohai-Support-reading-L1-info-from-ethtool.patch