From aef7a4ecb89e5196bcd3286a18129cda4913ab8e Mon Sep 17 00:00:00 2001 From: azzamsa Date: Wed, 29 Apr 2020 15:18:06 +0700 Subject: [PATCH] Fix - disk list size --- vcd_cli/disk.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vcd_cli/disk.py b/vcd_cli/disk.py index 96b49272..db46f132 100644 --- a/vcd_cli/disk.py +++ b/vcd_cli/disk.py @@ -87,6 +87,10 @@ def list_disks(ctx): if hasattr(disk, 'attached_vms') and \ hasattr(disk.attached_vms, 'VmReference'): attached_vms = disk.attached_vms.VmReference.get('name') + if 'size' in disk.keys(): + size_in_bytes = int(disk.get('size')) + else: + size_in_bytes = int(disk.get('sizeMb')) * (1024 * 1024) result.append({ 'name': disk.get('name'), @@ -95,9 +99,8 @@ def list_disks(ctx): 'owner': disk.Owner.User.get('name'), 'size': - humanfriendly.format_size(int(disk.get('size'))), - 'size_bytes': - disk.get('size'), + humanfriendly.format_size(size_in_bytes), + 'size_bytes': size_in_bytes, 'status': VCLOUD_STATUS_MAP.get(int(disk.get('status'))), 'vms_attached':