AIX support to gather and return (averaged) IO stats.

def _iostat_aix(interval, count, disks):
    '''
    AIX support to gather and return (averaged) IO stats.
    '''
    log.debug('DGM disk iostat entry')

    if disks is None:
        iostat_cmd = 'iostat -dD {0} {1} '.format(interval, count)
    elif isinstance(disks, six.string_types):
        iostat_cmd = 'iostat -dD {0} {1} {2}'.format(disks, interval, count)
    else:
        iostat_cmd = 'iostat -dD {0} {1} {2}'.format(' '.join(disks), interval, count)

    ret = {}
    procn = None
    fields = []
    disk_name = ''
    disk_mode = ''
    dev_stats = collections.defaultdict(list)
    for line in __salt__['cmd.run'](iostat_cmd).splitlines():
        # Note: iostat -dD is per-system
        #
        #root@l490vp031_pub:~/devtest# iostat -dD hdisk6 1 3
        #
        #System configuration: lcpu=8 drives=1 paths=2 vdisks=2
        #
        #hdisk6          xfer:  %tm_act      bps      tps      bread      bwrtn
        #                          0.0      0.0      0.0        0.0        0.0
        #                read:      rps  avgserv  minserv  maxserv   timeouts      fails
        #                          0.0      0.0      0.0      0.0           0          0
        #               write:      wps  avgserv  minserv  maxserv   timeouts      fails
        #                          0.0      0.0      0.0      0.0           0          0
        #               queue:  avgtime  mintime  maxtime  avgwqsz    avgsqsz     sqfull
        #                          0.0      0.0      0.0      0.0        0.0         0.0
        #--------------------------------------------------------------------------------
        #
        #hdisk6          xfer:  %tm_act      bps      tps      bread      bwrtn
        #                          9.6     16.4K     4.0       16.4K       0.0
        #                read:      rps  avgserv  minserv  maxserv   timeouts      fails
        #                          4.0      4.9      0.3      9.9           0          0
        #               write:      wps  avgserv  minserv  maxserv   timeouts      fails
        #                          0.0      0.0      0.0      0.0           0          0
        #               queue:  avgtime  mintime  maxtime  avgwqsz    avgsqsz     sqfull
        #                          0.0      0.0      0.0      0.0        0.0         0.0
        #--------------------------------------------------------------------------------
        #
        #hdisk6          xfer:  %tm_act      bps      tps      bread      bwrtn
        #                          0.0      0.0      0.0        0.0        0.0
        #                read:      rps  avgserv  minserv  maxserv   timeouts      fails
        #                          0.0      0.0      0.3      9.9           0          0
        #               write:      wps  avgserv  minserv  maxserv   timeouts      fails
        #                          0.0      0.0      0.0      0.0           0          0
        #               queue:  avgtime  mintime  maxtime  avgwqsz    avgsqsz     sqfull
        #                          0.0      0.0      0.0      0.0        0.0         0.0
        #--------------------------------------------------------------------------------
        if not line or line.startswith('System') or line.startswith('-----------'):
            continue

        if not re.match(r'\s', line):
            #seen disk name
            dsk_comps = line.split(':')
            dsk_firsts = dsk_comps[0].split()
            disk_name = dsk_firsts[0]
            disk_mode = dsk_firsts[1]
            fields = dsk_comps[1].split()
            if disk_name not in dev_stats.keys():
                dev_stats[disk_name] = []
                procn = len(dev_stats[disk_name])
                dev_stats[disk_name].append({})
                dev_stats[disk_name][procn][disk_mode] = {}
                dev_stats[disk_name][procn][disk_mode]['fields'] = fields
                dev_stats[disk_name][procn][disk_mode]['stats'] = []
            continue

        if ':' in line:
            comps = line.split(':')
            fields = comps[1].split()
            disk_mode = comps[0].lstrip()
            if disk_mode not in dev_stats[disk_name][0].keys():
                dev_stats[disk_name][0][disk_mode] = {}
                dev_stats[disk_name][0][disk_mode]['fields'] = fields
                dev_stats[disk_name][0][disk_mode]['stats'] = []
        else:
            line = line.split()
            stats = [_parse_numbers(x) for x in line[:]]
            dev_stats[disk_name][0][disk_mode]['stats'].append(stats)

    iostats = {}

    for disk, list_modes in dev_stats.items():
        iostats[disk] = {}
        for modes in list_modes:
            for disk_mode in modes.keys():
                fields = modes[disk_mode]['fields']
                stats = modes[disk_mode]['stats']
                iostats[disk][disk_mode] = _iostats_dict(fields, stats)

    return iostats