storage/file: fix disk usage reporting

Do not report root image usage in template-based VMs. This space is used
only once - by template.
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-30 18:36:23 +02:00
parent 8a8674bb57
commit b9c217704c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -337,7 +337,13 @@ class FileVolume(qubes.storage.Volume):
@property
def usage(self):
''' Returns the actualy used space '''
return get_disk_usage(self.vid)
usage = 0
if self.save_on_stop or self.snap_on_start:
usage = get_disk_usage(self.path_cow)
if self.save_on_stop or not self.snap_on_start:
usage += get_disk_usage(self.path)
return usage
def create_sparse_file(path, size):