Fix sriov device parser

Closes-bug: #1607175
Change-Id: I40aad65e5ec17969af986bd815769b968463d20a
This commit is contained in:
Vitalii Kovalchuk 2016-07-28 16:46:05 +03:00 committed by Illia Polliul
parent f947bbbeeb
commit 4912a31292
1 changed files with 8 additions and 6 deletions

View File

@ -41,11 +41,14 @@ module Puppet::Parser::Functions
network_interface_path = "/sys/class/net/" + network_interface
if (File.exists?(network_interface_path + "/device/sriov_totalvfs") and
not bridge_interfaces.include?(network_interface) and
not bond_interfaces.include?(network_interface)) and
IO.read(network_interface_path + "/operstate").to_s.strip == "up"
sriov_hash[network_interface] = Hash.new
sriov_hash[network_interface]["totalvfs"] = IO.read(network_interface_path + "/device/sriov_totalvfs").to_i
sriov_hash[network_interface]["numvfs"] = IO.read(network_interface_path + "/device/sriov_numvfs").to_i
not bond_interfaces.include?(network_interface))
system "ip link set #{network_interface} up"
sleep 30 # wait to be sure that interface became up
if IO.read(network_interface_path + "/operstate").to_s.strip == "up"
sriov_hash[network_interface] = Hash.new
sriov_hash[network_interface]["totalvfs"] = IO.read(network_interface_path + "/device/sriov_totalvfs").to_i
sriov_hash[network_interface]["numvfs"] = IO.read(network_interface_path + "/device/sriov_numvfs").to_i
end
end
end
@ -69,4 +72,3 @@ module Puppet::Parser::Functions
return sriov_hash
end
end