qvm-ls: fix total VM size reporting

There is no vm.storage object in qubesadmin module.
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-29 04:50:19 +02:00
parent 80f1dd7d13
commit 7db2ed82ea
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 5 additions and 1 deletions

View File

@ -351,7 +351,7 @@ Column('MEMORY',
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.')

View File

@ -257,6 +257,10 @@ class QubesVM(qubesadmin.base.PropertyHolder):
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