From: Enea Armband Devops Team 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 | 30 ++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 31 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..8ae8c49 --- /dev/null +++ b/debian/patches/0001-ohai-Support-reading-L1-info-from-ethtool.patch @@ -0,0 +1,30 @@ +From: Alexandru Avadanii +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 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