Skip to content

Commit

Permalink
qvm-ls: fix total VM size reporting
Browse files Browse the repository at this point in the history
There is no vm.storage object in qubesadmin module.
  • Loading branch information
marmarek committed Jul 29, 2017
1 parent 80f1dd7 commit 7db2ed8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion qubesadmin/tools/qvm_ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def calc_used(vm, volume_name):
doc='Memory currently used by VM')

Column('DISK',
attr=(lambda vm: vm.storage.get_disk_utilization() / 1024 / 1024),
attr=(lambda vm: vm.get_disk_utilization() // 1024 // 1024),
doc='Total disk utilisation.')


Expand Down
4 changes: 4 additions & 0 deletions qubesadmin/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ def volumes(self):
vm=self.name, vm_name=volname)
return self._volumes

def get_disk_utilization(self):
'''Get total disk usage of the VM'''
return sum(vol.usage for vol in self.volumes.values())

def run_service(self, service, **kwargs):
'''Run service on this VM
Expand Down

0 comments on commit 7db2ed8

Please sign in to comment.