(self, block)
return ret
Parse the state of the the md array members.

        >>> block = 'md0 : active raid1 sdd2[0] sdb2[2](S) sdc2[1]\n'
        >>>         '      100171776 blocks super 1.2 [2/2] [UU]\n'
        >>>         '      bitmap: 1/1 pages [4KB], 65536KB chunk\n\n'
        >>> print _parse_array_member_state(block)
        {
            'active': 2,
            'faulty': 0,
            'spare': 1
        }

        :return: dictionary of states with according count
        :rtype: dict
Parse the state of the the md array members.
Parse the state of the the md array members .
def _parse_array_member_state(self, block):
        """
        Parse the state of the the md array members.

        >>> block = 'md0 : active raid1 sdd2[0] sdb2[2](S) sdc2[1]\n'
        >>>         '      100171776 blocks super 1.2 [2/2] [UU]\n'
        >>>         '      bitmap: 1/1 pages [4KB], 65536KB chunk\n\n'
        >>> print _parse_array_member_state(block)
        {
            'active': 2,
            'faulty': 0,
            'spare': 1
        }

        :return: dictionary of states with according count
        :rtype: dict
        """
        members = block.split('\n')[0].split(' : ')[1].split(' ')[2:]

        device_regexp = re.compile(
            '^(?P<member_name>.*)'
            '\[(?P<member_role_number>\d*)\]'
            '\(?(?P<member_state>[FS])?\)?$'
        )

        ret = {
            'active': 0,
            'faulty': 0,
            'spare': 0
        }
        for member in members:
            member_dict = device_regexp.match(member).groupdict()

            if member_dict['member_state'] == 'S':
                ret['spare'] += 1
            elif member_dict['member_state'] == 'F':
                ret['faulty'] += 1
            else:
                ret['active'] += 1

        return ret
def _parse_array_member_state ( self , block ) : members = block . split ( '\n' ) [ 0 ] . split ( ' : ' ) [ 1 ] . split ( ' ' ) [ 2 : ] device_regexp = re . compile ( '^(?P<member_name>.*)' '\[(?P<member_role_number>\d*)\]' '\(?(?P<member_state>[FS])?\)?$' ) ret = { 'active' : 0 , 'faulty' : 0 , 'spare' : 0 } for member in members : member_dict = device_regexp . match ( member ) . groupdict ( ) if member_dict [ 'member_state' ] == 'S' : ret [ 'spare' ] += 1 elif member_dict [ 'member_state' ] == 'F' : ret [ 'faulty' ] += 1 else : ret [ 'active' ] += 1 return ret