Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Fix - disk list size
Browse files Browse the repository at this point in the history
  • Loading branch information
azzamsa committed May 20, 2020
1 parent 0d88338 commit aef7a4e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions vcd_cli/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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':
Expand Down

0 comments on commit aef7a4e

Please sign in to comment.