Skip to content

Commit 5003db8

Browse files
committed
updated udev rules to match those found in 45drives-tools, added write option to thermal benchmark scripts
1 parent dfeff63 commit 5003db8

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

thermal_scripts/tbench

+23-5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def wizard(params,server_info):
1515
params["max_duration"] = get_test_duration()
1616
params["polling_interval"], tmap_result = get_tmap_interval()
1717
params["fio_flag"] = get_fio_setting()
18+
params["fio_write"] = get_fio_write()
1819
params["graph_flag"] = get_graph_flag()
1920
params["graph_settings"] = get_graph_settings(params,server_info,tmap_result) if params["graph_flag"] else {}
2021
params["rsync_settings"] = get_rsync_params()
@@ -104,6 +105,24 @@ def get_fio_setting():
104105
flag = False
105106
return flag
106107

108+
def get_fio_write():
109+
selection = ""
110+
flag = True
111+
while selection not in ["y","Y","n","N"]:
112+
selection = input("Would you like to perform WRITES on all storage disks between measurements using fio? (y/n): ")
113+
if selection not in ["y","Y","n","N"]:
114+
print("Invalid selection. Try again.")
115+
if selection in ["y","Y"]:
116+
confirm = input("Are you sure? Data can and will be corrupted on your storage disks if you write. (type 'yesiamsure' to confirm): ")
117+
if confirm == "yesiamsure":
118+
flag = True
119+
else:
120+
print("yesiamsure not entered. Defaulting to read only.")
121+
flag = False
122+
if selection in ["n","N"]:
123+
flag = False
124+
return flag
125+
107126
def get_graph_flag():
108127
selection = ""
109128
flag = True
@@ -177,17 +196,15 @@ def run_tplot(params):
177196
#./tplot -o output/$TEST_NAME.csv -d 120 -i 10 -s 3 -f
178197
steady_state = 3 + int((60/params["polling_interval"]))
179198

180-
command = "./tplot -o output/{tn}.csv -d {dur} -i {pi} -s {ss} {fio}".format(
199+
command = "./tplot -o output/{tn}.csv -d {dur} -i {pi} -s {ss} {fio} {write}".format(
181200
tn=params["test_name"],
182201
dur=params["max_duration"],
183202
pi=params["polling_interval"],
184203
ss=steady_state,
185-
fio = "-f" if params["fio_flag"] else ""
204+
fio = "-f" if params["fio_flag"] else "",
205+
write = "-w" if params["fio_flag"] and params["fio_write"] else ""
186206
)
187207
return os.system(command)
188-
189-
190-
191208

192209

193210
def run_csv_converter(params):
@@ -243,6 +260,7 @@ def main():
243260
"max_duration": 3600,
244261
"polling_interval": 60,
245262
"fio_flag": True,
263+
"write_flag": False,
246264
"graph_flag": True,
247265
"graph_settings": {},
248266
"rsync_settings": {}

thermal_scripts/tplot

+5-2
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def show_print(win,msg,row=0):
316316
win.refresh()
317317
time.sleep(1)
318318

319-
def setup_fio_file(tmap_data):
319+
def setup_fio_file(tmap_data,write_flag):
320320
if os.path.isfile(os.path.expanduser("tbench.fio")):
321321
os.remove(os.path.expanduser("tbench.fio"))
322322
fio_job_file = open("tbench.fio","w")
@@ -331,6 +331,8 @@ def setup_fio_file(tmap_data):
331331

332332
FIO_PARAMS["global"]["filename"] = disk_string
333333
FIO_PARAMS["global"]["numjobs"] = str(len(tmap_data["DISKS"]))
334+
if write_flag == True:
335+
FIO_PARAMS["4k-rand-read"]["rw"] = "randwrite"
334336

335337
for param_group in FIO_PARAMS:
336338
fio_job_file.write(f"[{param_group}]\n")
@@ -369,7 +371,7 @@ def main(main_screen,args):
369371
# initialize t_data and get first reading
370372
t_data = []
371373
tmap_data = run_tmap(start_time)
372-
setup_fio_file(tmap_data)
374+
setup_fio_file(tmap_data,args.fio_write)
373375
t_data.append(tmap_data.copy())
374376

375377

@@ -431,5 +433,6 @@ if __name__ == "__main__":
431433
parser.add_option("-o", "--output_file", action="store", type="string",
432434
dest="output_file", default="tplot.csv", help="the name of the output file. [default: %default]")
433435
parser.add_option("-f", "--fio", action="store_true", dest="fio", help="use fio job to stress disks between temperature readings.")
436+
parser.add_option("-w", "--write", action="store_true", dest="fio_write", default=False, help="write to all disks using fio.")
434437
(args, cli_args) = parser.parse_args()
435438
curses.wrapper(main,args)

udev/68-vdev.rules

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# /usr/lib/udev/rules.d/68-vdev.rules
33
#
44

5+
# skip these rules if disk was handled by 67-ubm.rules
6+
ENV{DEVTYPE}=="disk", ENV{DISK_HANDLED_BY_UBM}=="1", GOTO="68-vdev_end"
7+
58
ENV{DEVTYPE}=="disk", IMPORT{program}="/usr/lib/udev/vdev_id_45drives -d %k -c /etc/vdev_id.conf"
69

710
KERNEL=="*[!0-9]", ENV{SUBSYSTEM}=="block", ENV{ID_VDEV}=="?*", SYMLINK+="$env{ID_VDEV_PATH}"
@@ -11,3 +14,4 @@ KERNEL=="*[0-9]", ENV{SUBSYSTEM}=="block", ENV{DEVTYPE}=="partition", ENV{ID_VDE
1114
KERNEL=="dm-[0-9]*", ENV{SUBSYSTEM}=="block", ENV{ID_VDEV}=="?*", SYMLINK+="$env{ID_VDEV_PATH}"
1215
KERNEL=="dm-[0-9]*", ENV{SUBSYSTEM}=="block", ENV{ID_VDEV}=="?*", SYMLINK+="$env{ID_VDEV_ALT_PATH}"
1316

17+
LABEL="68-vdev_end"

0 commit comments

Comments
 (0)