summaryrefslogtreecommitdiffstats
path: root/patches/fuel-nailgun-agent/0001-ohai-Support-reading-L1-info-from-ethtool.patch
blob: 911001f4fde8eee1297944cdb19683019f742149 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From: Enea Armband Devops Team <armband@enea.com>
Date: Sat, 2 Apr 2016 22:57:59 +0200
Subject: [PATCH] ohai: Support reading L1 info from ethtool.

Traditional methods of reading the ethernet card speed rely on the
drivers populating the advertised and/or supported link speed lists.

This is not true for all drivers, especially for some Fibers
that only report the speed via ethtool when the link is up.

This patch adds support for reading L1 info from ohai, which
supports parsing ethtool speed starting with version amos2 [1].

[1] https://linux.enea.com/mos-repos/ubuntu/8.0/pool/main/o/
    ohai/ohai_6.14.0-2~u14.04+mos1+mos8.0+amos2_all.deb
---
 ...ohai-Support-reading-L1-info-from-ethtool.patch | 34 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 debian/patches/0001-ohai-Support-reading-L1-info-from-ethtool.patch
 create mode 100644 debian/patches/series

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
new file mode 100644
index 0000000..aa50ea4
--- /dev/null
+++ b/debian/patches/0001-ohai-Support-reading-L1-info-from-ethtool.patch
@@ -0,0 +1,34 @@
+From 942c67f74c00b1097d1ad27ece79fe91b475190c Mon Sep 17 00:00:00 2001
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Sat, 2 Apr 2016 22:54:27 +0200
+Subject: [PATCH] ohai: Support reading L1 info from ethtool.
+
+Upstream ohai [1] introduces support for reading layer one information
+from ethtool. Allow nailgun-agent to use that info if present.
+
+[1] https://github.com/chef/ohai/commit/
+    afd42e9122f057ab00dd24357c28dc2ad6806434
+---
+ agent | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/agent b/agent
+index c764a68..978131f 100755
+--- a/agent
++++ b/agent
+@@ -316,7 +316,11 @@ class NodeAgent
+                 int_meta[:current_speed] = int_info.current_mode.speed
+               end
+             rescue
+-              int_meta[:current_speed] = nil
++              if intinfo.has_key?(:link_speed) && 0 < intinfo[:link_speed]
++                int_meta[:current_speed] = intinfo[:link_speed]
++              else
++                int_meta[:current_speed] = nil
++              end
+             end
+           elsif (addrinfo[:family] rescue nil) =~ /^inet$/
+             int_meta[:ip] = addr
+--
+1.9.1
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..b221a98
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-ohai-Support-reading-L1-info-from-ethtool.patch