mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-11 01:10:37 +02:00
add initial mdadm parser
This commit is contained in:
@ -66,6 +66,7 @@ parsers = [
|
||||
'lsof',
|
||||
'lsusb',
|
||||
'm3u',
|
||||
'mdadm',
|
||||
'mount',
|
||||
'mpstat',
|
||||
'mpstat-s',
|
||||
|
222
jc/parsers/mdadm.py
Normal file
222
jc/parsers/mdadm.py
Normal file
@ -0,0 +1,222 @@
|
||||
"""jc - JSON Convert `mdadm` command output parser
|
||||
|
||||
<<Short mdadm description and caveats>>
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ mdadm | jc --mdadm
|
||||
|
||||
or
|
||||
|
||||
$ jc mdadm
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('mdadm', mdadm_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"mdadm": string,
|
||||
"bar": boolean,
|
||||
"baz": integer
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ mdadm | jc --mdadm -p
|
||||
[]
|
||||
|
||||
$ mdadm | jc --mdadm -p -r
|
||||
[]
|
||||
"""
|
||||
from typing import List, Dict
|
||||
import jc.utils
|
||||
from jc.parsers.universal import sparse_table_parse
|
||||
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.0'
|
||||
description = '`mdadm` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
compatible = ['linux']
|
||||
magic_commands = ['mdadm']
|
||||
|
||||
|
||||
__version__ = info.version
|
||||
|
||||
|
||||
def _process(proc_data: Dict) -> Dict:
|
||||
"""
|
||||
Final processing to conform to the schema.
|
||||
|
||||
Parameters:
|
||||
|
||||
proc_data: (List of Dictionaries) raw structured data to process
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Structured to conform to the schema.
|
||||
"""
|
||||
int_list = {'array_size_num', 'used_dev_size_num', 'raid_devices', 'total_devices',
|
||||
'active_devices', 'working_devices', 'failed_devices', 'spare_devices',
|
||||
'events', 'number', 'major', 'minor', 'raid_device', 'avail_dev_size_num',
|
||||
'data_offset', 'super_offset', 'unused_space_before', 'unused_space_after',
|
||||
'chunk_size', 'preferred_minor', 'check_status_percent', 'resync_status_percent'}
|
||||
|
||||
array_state_map = {
|
||||
'A': 'active',
|
||||
'.': 'missing',
|
||||
'R': 'replacing'
|
||||
}
|
||||
|
||||
# split combined values
|
||||
if 'array_size' in proc_data:
|
||||
proc_data['array_size_num'] = proc_data['array_size'].split(maxsplit=1)[0]
|
||||
|
||||
if 'used_dev_size' in proc_data:
|
||||
proc_data['used_dev_size_num'] = proc_data['used_dev_size'].split(maxsplit=1)[0]
|
||||
|
||||
if 'avail_dev_size' in proc_data:
|
||||
proc_data['avail_dev_size_num'] = proc_data['avail_dev_size'].split(maxsplit=1)[0]
|
||||
|
||||
if 'data_offset' in proc_data:
|
||||
proc_data['data_offset'] = proc_data['data_offset'].split()[0]
|
||||
|
||||
if 'super_offset' in proc_data:
|
||||
proc_data['super_offset'] = proc_data['super_offset'].split()[0]
|
||||
|
||||
if 'unused_space' in proc_data:
|
||||
unused_space_list = proc_data['unused_space'].split(',')
|
||||
before_text = unused_space_list[0].strip()
|
||||
after_text = unused_space_list[1].strip()
|
||||
before = before_text.split('=')[1].split()[0]
|
||||
after = after_text.split('=')[1].split()[0]
|
||||
proc_data['unused_space_before'] = before
|
||||
proc_data['unused_space_after'] = after
|
||||
|
||||
if 'name' in proc_data:
|
||||
proc_data['name_val'] = proc_data['name'].split(maxsplit=1)[0]
|
||||
|
||||
if 'checksum' in proc_data:
|
||||
proc_data['checksum_val'] = proc_data['checksum'].split(maxsplit=1)[0]
|
||||
proc_data['checksum_state'] = proc_data['checksum'].split()[-1]
|
||||
|
||||
if 'state' in proc_data:
|
||||
state_list = [x.strip() for x in proc_data['state'].split(',')]
|
||||
proc_data['state_list'] = state_list
|
||||
|
||||
if 'flags' in proc_data:
|
||||
proc_data['flag_list'] = proc_data['flags'].split()
|
||||
|
||||
if 'array_state' in proc_data:
|
||||
array_state_list = []
|
||||
array_state_text = proc_data['array_state'].split(maxsplit=1)[0]
|
||||
|
||||
for item in array_state_text:
|
||||
array_state_list.append(array_state_map[item])
|
||||
|
||||
proc_data['array_state_list'] = array_state_list
|
||||
|
||||
if 'resync_status' in proc_data:
|
||||
proc_data['resync_status_percent'] = proc_data['resync_status'].split('%')[0]
|
||||
|
||||
if 'check_status' in proc_data:
|
||||
proc_data['check_status_percent'] = proc_data['check_status'].split('%')[0]
|
||||
|
||||
# add timestamp fields
|
||||
if 'creation_time' in proc_data:
|
||||
dt = jc.utils.timestamp(proc_data['creation_time'], format_hint=(1000,))
|
||||
proc_data['creation_time_epoch'] = dt.naive
|
||||
|
||||
if 'update_time' in proc_data:
|
||||
dt = jc.utils.timestamp(proc_data['update_time'], format_hint=(1000,))
|
||||
proc_data['update_time_epoch'] = dt.naive
|
||||
|
||||
# convert ints
|
||||
for key in proc_data:
|
||||
if key in int_list:
|
||||
proc_data[key] = jc .utils.convert_to_int(proc_data[key])
|
||||
|
||||
# table items
|
||||
if 'device_table' in proc_data:
|
||||
for item in proc_data['device_table']:
|
||||
if 'state' in item:
|
||||
item['state'] = item['state'].split()
|
||||
|
||||
# convert ints
|
||||
for key in item:
|
||||
if key in int_list:
|
||||
item[key] = jc.utils.convert_to_int(item[key])
|
||||
|
||||
return proc_data
|
||||
|
||||
|
||||
def parse(
|
||||
data: str,
|
||||
raw: bool = False,
|
||||
quiet: bool = False
|
||||
) -> Dict:
|
||||
"""
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
Returns:
|
||||
|
||||
List of Dictionaries. Raw or processed structured data.
|
||||
"""
|
||||
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||
jc.utils.input_type_check(data)
|
||||
|
||||
raw_output = {}
|
||||
device_table = False
|
||||
device_table_list = []
|
||||
|
||||
if jc.utils.has_data(data):
|
||||
|
||||
for line in filter(None, data.splitlines()):
|
||||
# device line
|
||||
if line.startswith('/') and line.endswith(':'):
|
||||
raw_output['device'] = line[:-1]
|
||||
continue
|
||||
|
||||
# key/value lines
|
||||
if ' : ' in line:
|
||||
key, value = line.split(' : ')
|
||||
key = key.strip().lower().replace(' ', '_')
|
||||
value = value.strip()
|
||||
raw_output[key] = value
|
||||
continue
|
||||
|
||||
# device table header
|
||||
if ' Number Major Minor RaidDevice State' in line:
|
||||
device_table_list.append(' number major minor RaidDevice state device')
|
||||
device_table = True
|
||||
continue
|
||||
|
||||
# device table lines
|
||||
if device_table == True:
|
||||
device_table_list.append(line)
|
||||
continue
|
||||
|
||||
if device_table_list:
|
||||
d_table = sparse_table_parse(device_table_list)
|
||||
for item in d_table:
|
||||
if 'RaidDevice' in item:
|
||||
item['raid_device'] = item.pop('RaidDevice')
|
||||
|
||||
raw_output['device_table'] = d_table
|
||||
|
||||
|
||||
|
||||
return raw_output if raw else _process(raw_output)
|
26
tests/fixtures/generic/mdadm/examine-raid0-offline
vendored
Normal file
26
tests/fixtures/generic/mdadm/examine-raid0-offline
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/dev/vda1:
|
||||
Magic : a92b4efc
|
||||
Version : 1.2
|
||||
Feature Map : 0x0
|
||||
Array UUID : 7e81a856:abb9c1c2:4b71237a:9778cc66
|
||||
Name : sysrescue:0 (local to host sysrescue)
|
||||
Creation Time : Sun Aug 7 20:56:52 2022
|
||||
Raid Level : raid0
|
||||
Raid Devices : 2
|
||||
|
||||
Avail Dev Size : 200704 sectors (98.00 MiB 102.76 MB)
|
||||
Data Offset : 4096 sectors
|
||||
Super Offset : 8 sectors
|
||||
Unused Space : before=4016 sectors, after=0 sectors
|
||||
State : clean
|
||||
Device UUID : a49d96f1:8e86ca03:5ff499ec:8cdd42bb
|
||||
|
||||
Update Time : Sun Aug 7 20:56:52 2022
|
||||
Bad Block Log : 512 entries available at offset 8 sectors
|
||||
Checksum : eeb6cbe3 - correct
|
||||
Events : 0
|
||||
|
||||
Chunk Size : 512K
|
||||
|
||||
Device Role : Active device 0
|
||||
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
|
26
tests/fixtures/generic/mdadm/examine-raid0-ok
vendored
Normal file
26
tests/fixtures/generic/mdadm/examine-raid0-ok
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/dev/vda1:
|
||||
Magic : a92b4efc
|
||||
Version : 1.2
|
||||
Feature Map : 0x0
|
||||
Array UUID : 7e81a856:abb9c1c2:4b71237a:9778cc66
|
||||
Name : sysrescue:0 (local to host sysrescue)
|
||||
Creation Time : Sun Aug 7 20:56:52 2022
|
||||
Raid Level : raid0
|
||||
Raid Devices : 2
|
||||
|
||||
Avail Dev Size : 200704 sectors (98.00 MiB 102.76 MB)
|
||||
Data Offset : 4096 sectors
|
||||
Super Offset : 8 sectors
|
||||
Unused Space : before=4016 sectors, after=0 sectors
|
||||
State : clean
|
||||
Device UUID : a49d96f1:8e86ca03:5ff499ec:8cdd42bb
|
||||
|
||||
Update Time : Sun Aug 7 20:56:52 2022
|
||||
Bad Block Log : 512 entries available at offset 8 sectors
|
||||
Checksum : eeb6cbe3 - correct
|
||||
Events : 0
|
||||
|
||||
Chunk Size : 512K
|
||||
|
||||
Device Role : Active device 0
|
||||
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
|
27
tests/fixtures/generic/mdadm/examine-raid1-0.90-ok
vendored
Normal file
27
tests/fixtures/generic/mdadm/examine-raid1-0.90-ok
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/dev/vda1:
|
||||
Magic : a92b4efc
|
||||
Version : 0.90.00
|
||||
UUID : 3f720601:29af5283:96fc04a8:108a4af7 (local to host sysrescue)
|
||||
Creation Time : Sun Aug 7 21:52:56 2022
|
||||
Raid Level : raid1
|
||||
Used Dev Size : 102336 (99.94 MiB 104.79 MB)
|
||||
Array Size : 102336 (99.94 MiB 104.79 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 2
|
||||
Preferred Minor : 0
|
||||
|
||||
Update Time : Sun Aug 7 21:54:35 2022
|
||||
State : clean
|
||||
Active Devices : 2
|
||||
Working Devices : 2
|
||||
Failed Devices : 0
|
||||
Spare Devices : 0
|
||||
Checksum : 7fb4bb0e - correct
|
||||
Events : 18
|
||||
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
this 0 254 1 0 active sync /dev/vda1
|
||||
|
||||
0 0 254 1 0 active sync /dev/vda1
|
||||
1 1 254 2 1 active sync /dev/vda2
|
28
tests/fixtures/generic/mdadm/examine-raid1-checking
vendored
Normal file
28
tests/fixtures/generic/mdadm/examine-raid1-checking
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/dev/md126:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 2
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:23:59 2022
|
||||
State : clean, checking
|
||||
Active Devices : 2
|
||||
Working Devices : 2
|
||||
Failed Devices : 0
|
||||
Spare Devices : 0
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Check Status : 21% complete
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 18
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
1 254 2 1 active sync /dev/vda2
|
27
tests/fixtures/generic/mdadm/examine-raid1-failfast
vendored
Normal file
27
tests/fixtures/generic/mdadm/examine-raid1-failfast
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/dev/vda2:
|
||||
Magic : a92b4efc
|
||||
Version : 1.2
|
||||
Feature Map : 0x0
|
||||
Array UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Raid Devices : 2
|
||||
|
||||
Avail Dev Size : 202752 sectors (99.00 MiB 103.81 MB)
|
||||
Array Size : 101376 KiB (99.00 MiB 103.81 MB)
|
||||
Data Offset : 2048 sectors
|
||||
Super Offset : 8 sectors
|
||||
Unused Space : before=1968 sectors, after=0 sectors
|
||||
State : clean
|
||||
Device UUID : 140a340b:69d5759c:b87ce67c:6579ce22
|
||||
|
||||
Flags : failfast
|
||||
Update Time : Sun Aug 7 21:37:34 2022
|
||||
Bad Block Log : 512 entries available at offset 16 sectors
|
||||
Checksum : 4bf42c40 - correct
|
||||
Events : 51
|
||||
|
||||
|
||||
Device Role : Active device 1
|
||||
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
|
26
tests/fixtures/generic/mdadm/examine-raid1-faulty1
vendored
Normal file
26
tests/fixtures/generic/mdadm/examine-raid1-faulty1
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/dev/vda1:
|
||||
Magic : a92b4efc
|
||||
Version : 1.2
|
||||
Feature Map : 0x0
|
||||
Array UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Raid Devices : 2
|
||||
|
||||
Avail Dev Size : 202752 sectors (99.00 MiB 103.81 MB)
|
||||
Array Size : 101376 KiB (99.00 MiB 103.81 MB)
|
||||
Data Offset : 2048 sectors
|
||||
Super Offset : 8 sectors
|
||||
Unused Space : before=1968 sectors, after=0 sectors
|
||||
State : clean
|
||||
Device UUID : 1ec6a01d:e96d7f47:59970cf2:f0c056d2
|
||||
|
||||
Update Time : Sun Aug 7 21:28:34 2022
|
||||
Bad Block Log : 512 entries available at offset 16 sectors
|
||||
Checksum : 2e18e0bb - correct
|
||||
Events : 25
|
||||
|
||||
|
||||
Device Role : Active device 0
|
||||
Array State : A. ('A' == active, '.' == missing, 'R' == replacing)
|
26
tests/fixtures/generic/mdadm/examine-raid1-faulty2
vendored
Normal file
26
tests/fixtures/generic/mdadm/examine-raid1-faulty2
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/dev/vda2:
|
||||
Magic : a92b4efc
|
||||
Version : 1.2
|
||||
Feature Map : 0x0
|
||||
Array UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Raid Devices : 2
|
||||
|
||||
Avail Dev Size : 202752 sectors (99.00 MiB 103.81 MB)
|
||||
Array Size : 101376 KiB (99.00 MiB 103.81 MB)
|
||||
Data Offset : 2048 sectors
|
||||
Super Offset : 8 sectors
|
||||
Unused Space : before=1968 sectors, after=0 sectors
|
||||
State : clean
|
||||
Device UUID : 66e4da05:9cc62990:0620d976:579c0948
|
||||
|
||||
Update Time : Sun Aug 7 21:27:02 2022
|
||||
Bad Block Log : 512 entries available at offset 16 sectors
|
||||
Checksum : 597fbb6b - correct
|
||||
Events : 23
|
||||
|
||||
|
||||
Device Role : Active device 1
|
||||
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
|
27
tests/fixtures/generic/mdadm/examine-raid1-moreflags
vendored
Normal file
27
tests/fixtures/generic/mdadm/examine-raid1-moreflags
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/dev/vda2:
|
||||
Magic : a92b4efc
|
||||
Version : 1.2
|
||||
Feature Map : 0x0
|
||||
Array UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Raid Devices : 2
|
||||
|
||||
Avail Dev Size : 202752 sectors (99.00 MiB 103.81 MB)
|
||||
Array Size : 101376 KiB (99.00 MiB 103.81 MB)
|
||||
Data Offset : 2048 sectors
|
||||
Super Offset : 8 sectors
|
||||
Unused Space : before=1968 sectors, after=0 sectors
|
||||
State : clean
|
||||
Device UUID : cc336e3b:67a49dea:480135ed:9e1280cd
|
||||
|
||||
Flags : write-mostly failfast
|
||||
Update Time : Sun Aug 7 21:48:58 2022
|
||||
Bad Block Log : 512 entries available at offset 16 sectors
|
||||
Checksum : e5554588 - correct
|
||||
Events : 78
|
||||
|
||||
|
||||
Device Role : Active device 1
|
||||
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
|
26
tests/fixtures/generic/mdadm/examine-raid1-ok
vendored
Normal file
26
tests/fixtures/generic/mdadm/examine-raid1-ok
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/dev/vda1:
|
||||
Magic : a92b4efc
|
||||
Version : 1.2
|
||||
Feature Map : 0x0
|
||||
Array UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Raid Devices : 2
|
||||
|
||||
Avail Dev Size : 202752 sectors (99.00 MiB 103.81 MB)
|
||||
Array Size : 101376 KiB (99.00 MiB 103.81 MB)
|
||||
Data Offset : 2048 sectors
|
||||
Super Offset : 8 sectors
|
||||
Unused Space : before=1968 sectors, after=0 sectors
|
||||
State : clean
|
||||
Device UUID : 1ec6a01d:e96d7f47:59970cf2:f0c056d2
|
||||
|
||||
Update Time : Sun Aug 7 21:20:08 2022
|
||||
Bad Block Log : 512 entries available at offset 16 sectors
|
||||
Checksum : 2e1bdeb8 - correct
|
||||
Events : 17
|
||||
|
||||
|
||||
Device Role : Active device 0
|
||||
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
|
28
tests/fixtures/generic/mdadm/examine-raid1-replacing
vendored
Normal file
28
tests/fixtures/generic/mdadm/examine-raid1-replacing
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/dev/vda2:
|
||||
Magic : a92b4efc
|
||||
Version : 1.2
|
||||
Feature Map : 0x12
|
||||
Array UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Raid Devices : 2
|
||||
|
||||
Avail Dev Size : 202752 sectors (99.00 MiB 103.81 MB)
|
||||
Array Size : 101376 KiB (99.00 MiB 103.81 MB)
|
||||
Data Offset : 2048 sectors
|
||||
Super Offset : 8 sectors
|
||||
Recovery Offset : 115200 sectors
|
||||
Unused Space : before=1968 sectors, after=0 sectors
|
||||
State : clean
|
||||
Device UUID : cc336e3b:67a49dea:480135ed:9e1280cd
|
||||
|
||||
Flags : write-mostly failfast
|
||||
Update Time : Sun Aug 7 21:48:15 2022
|
||||
Bad Block Log : 512 entries available at offset 16 sectors
|
||||
Checksum : e55a076b - correct
|
||||
Events : 75
|
||||
|
||||
|
||||
Device Role : Replacement device 1
|
||||
Array State : AR ('A' == active, '.' == missing, 'R' == replacing)
|
28
tests/fixtures/generic/mdadm/examine-raid1-resync
vendored
Normal file
28
tests/fixtures/generic/mdadm/examine-raid1-resync
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/dev/md126:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 2
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:25:52 2022
|
||||
State : clean, resyncing
|
||||
Active Devices : 2
|
||||
Working Devices : 2
|
||||
Failed Devices : 0
|
||||
Spare Devices : 0
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Resync Status : 27% complete
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 20
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
1 254 2 1 active sync /dev/vda2
|
26
tests/fixtures/generic/mdadm/examine-raid1-spare
vendored
Normal file
26
tests/fixtures/generic/mdadm/examine-raid1-spare
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/dev/vda4:
|
||||
Magic : a92b4efc
|
||||
Version : 1.2
|
||||
Feature Map : 0x0
|
||||
Array UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Raid Devices : 2
|
||||
|
||||
Avail Dev Size : 202752 sectors (99.00 MiB 103.81 MB)
|
||||
Array Size : 101376 KiB (99.00 MiB 103.81 MB)
|
||||
Data Offset : 2048 sectors
|
||||
Super Offset : 8 sectors
|
||||
Unused Space : before=1968 sectors, after=0 sectors
|
||||
State : clean
|
||||
Device UUID : 46b6f457:a3cf3db3:41217976:74a7243c
|
||||
|
||||
Update Time : Sun Aug 7 21:39:58 2022
|
||||
Bad Block Log : 512 entries available at offset 16 sectors
|
||||
Checksum : c265a5d4 - correct
|
||||
Events : 52
|
||||
|
||||
|
||||
Device Role : spare
|
||||
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
|
26
tests/fixtures/generic/mdadm/examine-raid1-syncing
vendored
Normal file
26
tests/fixtures/generic/mdadm/examine-raid1-syncing
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/dev/vda1:
|
||||
Magic : a92b4efc
|
||||
Version : 1.2
|
||||
Feature Map : 0x0
|
||||
Array UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Raid Devices : 2
|
||||
|
||||
Avail Dev Size : 202752 sectors (99.00 MiB 103.81 MB)
|
||||
Array Size : 101376 KiB (99.00 MiB 103.81 MB)
|
||||
Data Offset : 2048 sectors
|
||||
Super Offset : 8 sectors
|
||||
Unused Space : before=1968 sectors, after=0 sectors
|
||||
State : active
|
||||
Device UUID : 1ec6a01d:e96d7f47:59970cf2:f0c056d2
|
||||
|
||||
Update Time : Sun Aug 7 21:15:49 2022
|
||||
Bad Block Log : 512 entries available at offset 16 sectors
|
||||
Checksum : 2e1bdda4 - correct
|
||||
Events : 0
|
||||
|
||||
|
||||
Device Role : Active device 0
|
||||
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
|
27
tests/fixtures/generic/mdadm/mdadm-examine.out
vendored
Normal file
27
tests/fixtures/generic/mdadm/mdadm-examine.out
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/dev/sdb1:
|
||||
Magic : a92b4efc
|
||||
Version : 1.1
|
||||
Feature Map : 0x1
|
||||
Array UUID : 85c5b164:d58a5ada:14f5fe07:d642e843
|
||||
Name : virttest:0
|
||||
Creation Time : Tue Apr 13 23:22:16 2010
|
||||
Raid Level : raid1
|
||||
Raid Devices : 2
|
||||
|
||||
Avail Dev Size : 11721041656 sectors (5.46 TiB 6.00 TB)
|
||||
Array Size : 5860520828 KiB (5.46 TiB 6.00 TB)
|
||||
Data Offset : 264 sectors
|
||||
Super Offset : 0 sectors
|
||||
Unused Space : before=80 sectors, after=0 sectors
|
||||
State : clean
|
||||
Device UUID : 813162e5:2e865efe:02ba5570:7003165c
|
||||
|
||||
Internal Bitmap : 8 sectors from superblock
|
||||
Update Time : Tue Jul 26 20:16:31 2022
|
||||
Bad Block Log : 512 entries available at offset 72 sectors
|
||||
Checksum : f141a577 - correct
|
||||
Events : 2193679
|
||||
|
||||
|
||||
Device Role : Active device 0
|
||||
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
|
28
tests/fixtures/generic/mdadm/mdadm-query-detail.out
vendored
Normal file
28
tests/fixtures/generic/mdadm/mdadm-query-detail.out
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/dev/md0:
|
||||
Version : 1.1
|
||||
Creation Time : Tue Apr 13 23:22:16 2010
|
||||
Raid Level : raid1
|
||||
Array Size : 5860520828 (5.46 TiB 6.00 TB)
|
||||
Used Dev Size : 5860520828 (5.46 TiB 6.00 TB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 2
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Intent Bitmap : Internal
|
||||
|
||||
Update Time : Tue Jul 26 20:16:31 2022
|
||||
State : clean
|
||||
Active Devices : 2
|
||||
Working Devices : 2
|
||||
Failed Devices : 0
|
||||
Spare Devices : 0
|
||||
|
||||
Consistency Policy : bitmap
|
||||
|
||||
Name : virttest:0
|
||||
UUID : 85c5b164:d58a5ada:14f5fe07:d642e843
|
||||
Events : 2193679
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
3 8 17 0 active sync /dev/sdb1
|
||||
2 8 33 1 active sync /dev/sdc1
|
28
tests/fixtures/generic/mdadm/query-raid0-ok
vendored
Normal file
28
tests/fixtures/generic/mdadm/query-raid0-ok
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/dev/md0:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 20:56:52 2022
|
||||
Raid Level : raid0
|
||||
Array Size : 200704 (196.00 MiB 205.52 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 2
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 20:56:52 2022
|
||||
State : clean
|
||||
Active Devices : 2
|
||||
Working Devices : 2
|
||||
Failed Devices : 0
|
||||
Spare Devices : 0
|
||||
|
||||
Layout : -unknown-
|
||||
Chunk Size : 512K
|
||||
|
||||
Consistency Policy : none
|
||||
|
||||
Name : sysrescue:0 (local to host sysrescue)
|
||||
UUID : 7e81a856:abb9c1c2:4b71237a:9778cc66
|
||||
Events : 0
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
1 254 2 1 active sync /dev/vda2
|
28
tests/fixtures/generic/mdadm/query-raid1-failed-and-flags
vendored
Normal file
28
tests/fixtures/generic/mdadm/query-raid1-failed-and-flags
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/dev/md127:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 3
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:48:58 2022
|
||||
State : clean
|
||||
Active Devices : 2
|
||||
Working Devices : 2
|
||||
Failed Devices : 1
|
||||
Spare Devices : 0
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 78
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
2 254 2 1 active sync writemostly failfast /dev/vda2
|
||||
|
||||
3 254 4 - faulty /dev/vda4
|
28
tests/fixtures/generic/mdadm/query-raid1-faulty
vendored
Normal file
28
tests/fixtures/generic/mdadm/query-raid1-faulty
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/dev/md126:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 2
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:28:34 2022
|
||||
State : clean, degraded
|
||||
Active Devices : 1
|
||||
Working Devices : 1
|
||||
Failed Devices : 1
|
||||
Spare Devices : 0
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 25
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
- 0 0 1 removed
|
||||
|
||||
1 254 2 - faulty /dev/vda2
|
30
tests/fixtures/generic/mdadm/query-raid1-faulty-with-spare
vendored
Normal file
30
tests/fixtures/generic/mdadm/query-raid1-faulty-with-spare
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
/dev/md127:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 3
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:43:18 2022
|
||||
State : clean, degraded, recovering
|
||||
Active Devices : 1
|
||||
Working Devices : 2
|
||||
Failed Devices : 1
|
||||
Spare Devices : 1
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Rebuild Status : 24% complete
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 57
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
3 254 4 1 spare rebuilding /dev/vda4
|
||||
|
||||
2 254 2 - faulty failfast /dev/vda2
|
26
tests/fixtures/generic/mdadm/query-raid1-faulty_and_removed
vendored
Normal file
26
tests/fixtures/generic/mdadm/query-raid1-faulty_and_removed
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/dev/md127:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 1
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:32:27 2022
|
||||
State : clean, degraded
|
||||
Active Devices : 1
|
||||
Working Devices : 1
|
||||
Failed Devices : 0
|
||||
Spare Devices : 0
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 31
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
- 0 0 1 removed
|
26
tests/fixtures/generic/mdadm/query-raid1-ok
vendored
Normal file
26
tests/fixtures/generic/mdadm/query-raid1-ok
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/dev/md126:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 2
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:20:08 2022
|
||||
State : clean
|
||||
Active Devices : 2
|
||||
Working Devices : 2
|
||||
Failed Devices : 0
|
||||
Spare Devices : 0
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 17
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
1 254 2 1 active sync /dev/vda2
|
26
tests/fixtures/generic/mdadm/query-raid1-ok-0.9
vendored
Normal file
26
tests/fixtures/generic/mdadm/query-raid1-ok-0.9
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/dev/md0:
|
||||
Version : 0.90
|
||||
Creation Time : Sun Aug 7 21:52:56 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 102336 (99.94 MiB 104.79 MB)
|
||||
Used Dev Size : 102336 (99.94 MiB 104.79 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 2
|
||||
Preferred Minor : 0
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:54:35 2022
|
||||
State : clean
|
||||
Active Devices : 2
|
||||
Working Devices : 2
|
||||
Failed Devices : 0
|
||||
Spare Devices : 0
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
UUID : 3f720601:29af5283:96fc04a8:108a4af7 (local to host sysrescue)
|
||||
Events : 0.18
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
1 254 2 1 active sync /dev/vda2
|
26
tests/fixtures/generic/mdadm/query-raid1-ok-failfast
vendored
Normal file
26
tests/fixtures/generic/mdadm/query-raid1-ok-failfast
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/dev/md127:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 2
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:37:34 2022
|
||||
State : clean
|
||||
Active Devices : 2
|
||||
Working Devices : 2
|
||||
Failed Devices : 0
|
||||
Spare Devices : 0
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 51
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
2 254 2 1 active sync failfast /dev/vda2
|
28
tests/fixtures/generic/mdadm/query-raid1-ok-spare
vendored
Normal file
28
tests/fixtures/generic/mdadm/query-raid1-ok-spare
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/dev/md127:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 3
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:39:58 2022
|
||||
State : clean
|
||||
Active Devices : 2
|
||||
Working Devices : 3
|
||||
Failed Devices : 0
|
||||
Spare Devices : 1
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 52
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
2 254 2 1 active sync failfast /dev/vda2
|
||||
|
||||
3 254 4 - spare /dev/vda4
|
28
tests/fixtures/generic/mdadm/query-raid1-rebuild-failfast
vendored
Normal file
28
tests/fixtures/generic/mdadm/query-raid1-rebuild-failfast
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/dev/md127:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 2
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:36:17 2022
|
||||
State : clean, degraded, recovering
|
||||
Active Devices : 1
|
||||
Working Devices : 2
|
||||
Failed Devices : 0
|
||||
Spare Devices : 1
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Rebuild Status : 20% complete
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 37
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
2 254 2 1 failfast spare rebuilding /dev/vda2
|
29
tests/fixtures/generic/mdadm/query-raid1-spare-writem-rebuild
vendored
Normal file
29
tests/fixtures/generic/mdadm/query-raid1-spare-writem-rebuild
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
/dev/md127:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 3
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:47:42 2022
|
||||
State : clean, recovering
|
||||
Active Devices : 2
|
||||
Working Devices : 3
|
||||
Failed Devices : 0
|
||||
Spare Devices : 1
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Rebuild Status : 30% complete
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 74
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
2 254 2 1 writemostly failfast spare rebuilding /dev/vda2
|
||||
3 254 4 1 active sync /dev/vda4
|
28
tests/fixtures/generic/mdadm/query-raid1-syncing
vendored
Normal file
28
tests/fixtures/generic/mdadm/query-raid1-syncing
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/dev/md126:
|
||||
Version : 1.2
|
||||
Creation Time : Sun Aug 7 21:15:49 2022
|
||||
Raid Level : raid1
|
||||
Array Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Used Dev Size : 101376 (99.00 MiB 103.81 MB)
|
||||
Raid Devices : 2
|
||||
Total Devices : 2
|
||||
Persistence : Superblock is persistent
|
||||
|
||||
Update Time : Sun Aug 7 21:15:49 2022
|
||||
State : clean, resyncing
|
||||
Active Devices : 2
|
||||
Working Devices : 2
|
||||
Failed Devices : 0
|
||||
Spare Devices : 0
|
||||
|
||||
Consistency Policy : resync
|
||||
|
||||
Resync Status : 4% complete
|
||||
|
||||
Name : sysrescue:126 (local to host sysrescue)
|
||||
UUID : e054553a:fbccdcfe:0ae80bc8:9379377a
|
||||
Events : 0
|
||||
|
||||
Number Major Minor RaidDevice State
|
||||
0 254 1 0 active sync /dev/vda1
|
||||
1 254 2 1 active sync /dev/vda2
|
Reference in New Issue
Block a user