'Exec into an ES pod and query the diskspace on the persistent volume.
Returns: list of errors'

def check_elasticsearch_diskspace(self, pods_by_name):

    errors = []
    for pod_name in pods_by_name.keys():
        df_cmd = 'exec    {}    --    df    --output=ipcent,pcent    /elasticsearch/persistent'.format(pod_name)
        disk_output = self.exec_oc(df_cmd, [])
        lines = disk_output.splitlines()
        body_re = '\\s*(\\d+)%?\\s+(\\d+)%?\\s*$'
        if ((len(lines) != 2) or (len(lines[0].split()) != 2) or (not re.match(body_re, lines[1]))):
            errors.append(OpenShiftCheckException('BadDfResponse', 'Could    not    retrieve    storage    usage    from    logging    ES    pod    "{pod}".\nResponse    to    `df`    command    was:\n{output}'.format(pod=pod_name, output=disk_output)))
            continue
        (inode_pct, disk_pct) = re.match(body_re, lines[1]).groups()
        inode_pct_thresh = self.get_var('openshift_check_efk_es_inode_pct', default='90')
        if (int(inode_pct) >= int(inode_pct_thresh)):
            errors.append(OpenShiftCheckException('InodeUsageTooHigh', 'Inode    percent    usage    on    the    storage    volume    for    logging    ES    pod    "{pod}"\n        is    {pct},    greater    than    threshold    {limit}.\n        Note:    threshold    can    be    specified    in    inventory    with    {param}'.format(pod=pod_name, pct=str(inode_pct), limit=str(inode_pct_thresh), param='openshift_check_efk_es_inode_pct')))
        disk_pct_thresh = self.get_var('openshift_check_efk_es_storage_pct', default='80')
        if (int(disk_pct) >= int(disk_pct_thresh)):
            errors.append(OpenShiftCheckException('DiskUsageTooHigh', 'Disk    percent    usage    on    the    storage    volume    for    logging    ES    pod    "{pod}"\n        is    {pct},    greater    than    threshold    {limit}.\n        Note:    threshold    can    be    specified    in    inventory    with    {param}'.format(pod=pod_name, pct=str(disk_pct), limit=str(disk_pct_thresh), param='openshift_check_efk_es_storage_pct')))
    return errors
