summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Guryanov <dguryanov@mirantis.com>2016-05-20 17:43:45 +0300
committerDmitry Guryanov <dguryanov@mirantis.com>2016-06-06 09:45:37 +0000
commitc5d6963e0461d472ba3c037e73873753017127c7 (patch)
treeeddcc447fe206fe86c83dfc8e538e7bcdc15e230
parent5121bd658f6bc7006a73fc9309ece9dfa05057ca (diff)
Don't use Rethtool for retrieving driver information
Rethtool executes two ioctls SIOCETHTOOL, one with command ETHTOOL_GLINKSETTINGS and then with ETHTOOL_GDRVINFO, but some drivers (like virtio) don't implement ETHTOOL_GLINKSETTINGS, so it fails. I've send patch to the author of Rethtool, but he haven't replied yet, and it also will take some time to have this fix in out Rethtool package. So let's call ioctl seaprately if Rethtool::InterfaceSettings failed. Change-Id: Iea95e1b132a33621f7538c4b0ba43b134e2560ee
Notes
Notes (review): Code-Review+1: Oleg Gelbukh <ogelbukh@mirantis.com> Code-Review+1: Igor Kalnitsky <ikalnitsky@mirantis.com> Code-Review+2: Vladimir Sharshov <vsharshov@mirantis.com> Verified+1: Fuel CI <fuel-ci-bot@mirantis.com> Workflow+1: Vladimir Sharshov <vsharshov@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 06 Jun 2016 16:56:46 +0000 Reviewed-on: https://review.openstack.org/309447 Project: openstack/fuel-nailgun-agent Branch: refs/heads/master
-rwxr-xr-xagent20
1 files changed, 20 insertions, 0 deletions
diff --git a/agent b/agent
index ba933f8..b217b6a 100755
--- a/agent
+++ b/agent
@@ -434,6 +434,16 @@ class NodeAgent
434 rescue 434 rescue
435 int_meta[:current_speed] = nil 435 int_meta[:current_speed] = nil
436 end 436 end
437
438 unless int_meta[:driver]
439 # Rethtool::InterfaceSettings calls two ioctls: with
440 # ETHTOOL_CMD_GSET and ETHTOOL_CMD_GDRVINFO commands.
441 # But for virtio adapters the first is not implemented,
442 # but the second is. So try to get driver info at least
443 # in this fallback chain.
444 int_meta[:driver], int_meta[:bus_info] = _get_interface_driver_info(int)
445 end
446
437 elsif (addrinfo[:family] rescue nil) =~ /^inet$/ 447 elsif (addrinfo[:family] rescue nil) =~ /^inet$/
438 int_meta[:ip] = addr 448 int_meta[:ip] = addr
439 int_meta[:netmask] = addrinfo[:netmask] if addrinfo[:netmask] 449 int_meta[:netmask] = addrinfo[:netmask] if addrinfo[:netmask]
@@ -561,6 +571,16 @@ class NodeAgent
561 detailed_meta 571 detailed_meta
562 end 572 end
563 573
574 def _get_interface_driver_info(int)
575 cmd_driver = Rethtool::EthtoolCmdDriver.new
576 cmd_driver.cmd = Rethtool::ETHTOOL_CMD_GDRVINFO
577 data = Rethtool.ioctl(int, cmd_driver)
578 [data.driver.pack('c*').delete("\000"), data.bus_info.pack('c*').delete("\000")]
579 rescue => e
580 @logger.error("Error '#{e.message}' while obtaining #{int} driver info.")
581 [nil, nil]
582 end
583
564 def multipath_devices 584 def multipath_devices
565 dmsetup = `/sbin/dmsetup info -c --nameprefixes --noheadings -o blkdevname,subsystem,blkdevs_used,name,uuid` 585 dmsetup = `/sbin/dmsetup info -c --nameprefixes --noheadings -o blkdevname,subsystem,blkdevs_used,name,uuid`
566 # Example output: 586 # Example output: