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

add raid test, refs #21547

parent d628b7a0
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017, Florent Thiery
'''
Criticality: High
Checks that the server RAID array is fine.
'''
import glob
import subprocess
import sys
import os
GREEN = '\033[92m'
RED = '\033[91m'
DEF = '\033[0m'
def print_red(string):
print(RED + string + DEF)
def print_green(string):
print(GREEN + string + DEF)
def check_raid(dev):
cmd = 'mdadm -D /dev/%s' % dev
status, output = subprocess.getstatusoutput(cmd)
print(output)
return status != 0
if os.path.isfile('/proc/mdstat'):
all_ok = True
for r in glob.glob('/dev/md*'):
all_ok = min(check_raid(r), all_ok)
sys.exit(not all_ok)
else:
print('No software RAID array found, untestable')
sys.exit(2)
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