Avoid crash in I/O Benchmark with small disks

This commit is contained in:
2Shirt 2019-01-02 18:41:35 -07:00
parent 49c1987ccf
commit 97d0125c03
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 6 additions and 0 deletions

View file

@ -13,6 +13,9 @@ from functions.common import *
def export_io_graph(disk):
"""Exports PNG graph using gnuplot, returns file path as str."""
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(800, max_rate)
out_path = '{}/iobenchmark-{}.png'.format(

View file

@ -196,6 +196,9 @@ class osTicket():
# Create PNG graph
try:
graph_file = export_io_graph(dev)
except GenericError:
# No data to build graph, ignoring
pass
except (AttributeError, KeyError):
report.append('Failed to export graph')
else: