Avoid crash in I/O Benchmark with small disks
This commit is contained in:
parent
49c1987ccf
commit
97d0125c03
2 changed files with 6 additions and 0 deletions
|
|
@ -13,6 +13,9 @@ from functions.common import *
|
||||||
def export_io_graph(disk):
|
def export_io_graph(disk):
|
||||||
"""Exports PNG graph using gnuplot, returns file path as str."""
|
"""Exports PNG graph using gnuplot, returns file path as str."""
|
||||||
read_rates = disk.tests['I/O Benchmark'].read_rates
|
read_rates = disk.tests['I/O Benchmark'].read_rates
|
||||||
|
if not read_rates:
|
||||||
|
# No data, aborting
|
||||||
|
raise GenericError
|
||||||
max_rate = max(read_rates) / (1024**2)
|
max_rate = max(read_rates) / (1024**2)
|
||||||
max_rate = max(800, max_rate)
|
max_rate = max(800, max_rate)
|
||||||
out_path = '{}/iobenchmark-{}.png'.format(
|
out_path = '{}/iobenchmark-{}.png'.format(
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,9 @@ class osTicket():
|
||||||
# Create PNG graph
|
# Create PNG graph
|
||||||
try:
|
try:
|
||||||
graph_file = export_io_graph(dev)
|
graph_file = export_io_graph(dev)
|
||||||
|
except GenericError:
|
||||||
|
# No data to build graph, ignoring
|
||||||
|
pass
|
||||||
except (AttributeError, KeyError):
|
except (AttributeError, KeyError):
|
||||||
report.append('Failed to export graph')
|
report.append('Failed to export graph')
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue