Skip to content
Snippets Groups Projects
Commit 574c91ae authored by Florent Thiery's avatar Florent Thiery
Browse files

cancel tests if a raid operation is in progress, refs #21696

parent 5a8a0487
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ import re
import subprocess
import sys
import uuid
import glob
import utils
from utils import log
......@@ -39,6 +40,18 @@ def strip_colors(text):
return re.sub(r'\033\[[\d;]+m', '', text)
def raid_idle():
idle = True
devs = glob.glob('/sys/block/md*/md/sync_action')
for d in devs:
with open(d, 'r') as f:
sync_state = f.read()
if sync_state != "idle":
idle = False
print("State in %s is %s" % (d, sync_state))
return idle
class Tester():
USAGE = '''%s [-e] [-f] [-b] [-d] [-h] [msuser]
-e: send email with report.
......@@ -101,7 +114,12 @@ class Tester():
tests = self.discover_tests(basic_only, msuser)
if not tests:
sys.exit(1)
exit_code = self.run_tests(tests, email, email_if_fail)
if raid_idle():
exit_code = self.run_tests(tests, email, email_if_fail)
else:
print('A RAID check or operation is in progress, aborting tests')
exit_code = 1
sys.exit(exit_code)
def parse_file_header(self, path):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment