Setting timeout for calling lshw
In some cases lshw may take too long like when we have lot of partitions > 600. We avoid this problem with setting timeout for lshw. Change-Id: I67748bc18023f3f6edce0cc20d4f0486877723b2 Closes-bug: #1559167
This commit is contained in:
parent
08625168b3
commit
28dc110ea5
20
agent
20
agent
|
@ -902,21 +902,21 @@ class NodeAgent
|
|||
end
|
||||
|
||||
def _get_pci_dev_list
|
||||
lshw_path = `which lshw`.chomp
|
||||
exitstatus = $?
|
||||
if exitstatus == 0
|
||||
data = `#{lshw_path} -json`
|
||||
exitstatus = $?
|
||||
if exitstatus == 0
|
||||
return JSON.parse(data)
|
||||
lshw_timeout = @settings['lshw_timeout'] || 60
|
||||
Timeout::timeout(lshw_timeout) do
|
||||
lshw_path = `which lshw`.chomp
|
||||
if $?.success?
|
||||
data = `#{lshw_path} -json`
|
||||
return JSON.parse(data) if $?.success?
|
||||
@logger.warn("Can't get data from lshw. Reason: lshw exited with status #{$?.exitstatus}")
|
||||
else
|
||||
@logger.warn("Can't get data from lshw. Reason: lshw exited with status #{exitstatus}")
|
||||
@logger.warn("Can't find lshw. Reason: 'which lshw' returned exit status #{$?.exitstatus}")
|
||||
end
|
||||
else
|
||||
@logger.warn("Can't find lshw. Reason: 'which lshw' returned exit status #{exitstatus}")
|
||||
end
|
||||
{}
|
||||
rescue => e
|
||||
@logger.warn("Can't get data from lshw. Reason: #{e.message}")
|
||||
{}
|
||||
end
|
||||
|
||||
def get_numa_topology
|
||||
|
|
Loading…
Reference in New Issue