Space_Report.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:python-scripts 作者: PureStorage-OpenConnect 项目源码 文件源码
def write_output(interval):
    with open(report_file, 'w') as csvfile:
        fieldnames = ['Volume Name', 'Current Data Reduction', 'Data Reduction ' + interval, 'Current Size(GB)',
                      'Size ' + interval + ' Ago(GB)', interval + ' Growth(GB)']
        writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
        writer.writeheader()

        print('Parsing volume data.')

        # Loop through all volumes to get historical space data

        for currentvol in allvolumes:
            thisvol = array.get_volume(currentvol['name'], space='True', historical=interval)
            volname = thisvol[0]['name']
            volcurdr = round(thisvol[0]['data_reduction'], 2)
            volstartdr = round(thisvol[len(thisvol) - 1]['data_reduction'], 2)
            volstartsize = round(thisvol[0]['volumes'] / 1024 / 1024 / 1024, 2)
            volcursize = round(thisvol[len(thisvol) - 1]['volumes'] / 1024 / 1024 / 1024, 2)
            volsizedif = volcursize - volstartsize
            volsizedif = round(volsizedif, 2)
            writer.writerow(
                {'Volume Name': volname, 'Current Data Reduction': volcurdr, 'Data Reduction ' + interval: volstartdr,
                 'Current Size(GB)': volcursize, 'Size ' + interval + ' Ago(GB)': volstartsize, interval + ' Growth(GB)': volsizedif})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号