fix aliyun disk bug

pull/36/head
wangyong 2016-01-04 16:37:02 +08:00
parent ed6559bbe9
commit c2818870d3
1 changed files with 1 additions and 3 deletions

View File

@ -311,13 +311,11 @@ def excel_to_db(excel_file):
def get_ansible_asset_info(asset_ip, setup_info): def get_ansible_asset_info(asset_ip, setup_info):
print asset_ip
disk_need = {} disk_need = {}
disk_all = setup_info.get("ansible_devices") disk_all = setup_info.get("ansible_devices")
if disk_all: if disk_all:
for disk_name, disk_info in disk_all.iteritems(): for disk_name, disk_info in disk_all.iteritems():
print disk_name, disk_info if disk_name.startswith('sd') or disk_name.startswith('hd') or disk_name.startswith('vd') or disk_name.startswith('xvd'):
if disk_name.startswith('sd') or disk_name.startswith('hd') or disk_name.startswith('vd'):
disk_size = disk_info.get("size", '') disk_size = disk_info.get("size", '')
if 'M' in disk_size: if 'M' in disk_size:
disk_format = round(float(disk_size[:-2]) / 1000, 0) disk_format = round(float(disk_size[:-2]) / 1000, 0)