Fix sriov device parser
Closes-bug: #1607175 Change-Id: I40aad65e5ec17969af986bd815769b968463d20a
This commit is contained in:
parent
f947bbbeeb
commit
4912a31292
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue