Merge "ceilometer: Fix libvirt-bin group name for armband."
[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,30 @@
29 +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
30 +Date: Sat, 2 Apr 2016 22:54:27 +0200
31 +Subject: [PATCH] ohai: Support reading L1 info from ethtool.
32 +
33 +Upstream ohai [1] introduces support for reading layer one information
34 +from ethtool. Allow nailgun-agent to use that info if present.
35 +
36 +[1] https://github.com/chef/ohai/commit/
37 +    afd42e9122f057ab00dd24357c28dc2ad6806434
38 +---
39 + agent | 6 +++++-
40 + 1 file changed, 5 insertions(+), 1 deletion(-)
41 +
42 +diff --git a/agent b/agent
43 +index c764a68..978131f 100755
44 +--- a/agent
45 ++++ b/agent
46 +@@ -316,7 +316,11 @@ class NodeAgent
47 +                 int_meta[:current_speed] = int_info.current_mode.speed
48 +               end
49 +             rescue
50 +-              int_meta[:current_speed] = nil
51 ++              if intinfo.has_key?(:link_speed) && 0 < intinfo[:link_speed]
52 ++                int_meta[:current_speed] = intinfo[:link_speed]
53 ++              else
54 ++                int_meta[:current_speed] = nil
55 ++              end
56 +             end
57 +           elsif (addrinfo[:family] rescue nil) =~ /^inet$/
58 +             int_meta[:ip] = addr
59 diff --git a/debian/patches/series b/debian/patches/series
60 new file mode 100644
61 index 0000000..b221a98
62 --- /dev/null
63 +++ b/debian/patches/series
64 @@ -0,0 +1 @@
65 +0001-ohai-Support-reading-L1-info-from-ethtool.patch