Add 'Container' field for MD parser

The logic of filtering of fake RAID MD heavily relies on the
presence of of 'Container' field inside of parsed data.
If this field is missing, it will never figure out the name of any
fake RAID devices and its component.

This patch adds this field to a parser.

In addition to that, it also logs all found fake RAIDs and
their components for the sake of easy debugging.

Change-Id: I2066c5a0e995e542271cd308c9d83e2373787be4
Closes-Bug: #1617071
This commit is contained in:
Alexander Gordeev 2016-09-20 19:11:01 +03:00
parent 79ca6e27f7
commit 6017353766
1 changed files with 5 additions and 1 deletions

6
agent
View File

@ -913,7 +913,8 @@ class NodeAgent
begin begin
description, _, components = data.split(/Number\s+Major\s+Minor\s+RaidDevice\s+(State\s+)?/m) description, _, components = data.split(/Number\s+Major\s+Minor\s+RaidDevice\s+(State\s+)?/m)
line_patterns = ['Version', 'Raid Level', 'Raid Devices', 'Active Devices', line_patterns = ['Version', 'Raid Level', 'Raid Devices', 'Active Devices',
'Spare Devices', 'Failed Devices', 'State', 'UUID'] 'Spare Devices', 'Failed Devices', 'State', 'UUID',
'Container']
for line in (description.split("\n")[1..-1] rescue []) for line in (description.split("\n")[1..-1] rescue [])
line.strip! line.strip!
next if line == "" next if line == ""
@ -961,6 +962,9 @@ class NodeAgent
mds, devices = _find_fake_raid_mds() mds, devices = _find_fake_raid_mds()
@logger.debug("Found fake RAIDs: #{mds}")
@logger.debug("Found components of fake RAIDs: #{devices}")
Dir["/sys/block/*"].each do |block_device_dir| Dir["/sys/block/*"].each do |block_device_dir|
basename_dir = File.basename(block_device_dir) basename_dir = File.basename(block_device_dir)
# Entries in /sys/block for cciss look like cciss!c0d1 while # Entries in /sys/block for cciss look like cciss!c0d1 while