diff --git a/qubes/storage/file.py b/qubes/storage/file.py index b768fa51..7b12518e 100644 --- a/qubes/storage/file.py +++ b/qubes/storage/file.py @@ -28,6 +28,7 @@ import os import os.path import re import subprocess +from contextlib import suppress import qubes.storage @@ -394,6 +395,17 @@ class FileVolume(qubes.storage.Volume): iso_date = qubes.storage.isodate(seconds).split('.', 1)[0] return {'old': iso_date} + @property + def size(self): + with suppress(FileNotFoundError): + self._size = os.path.getsize(self.path) + return self._size + + @size.setter + def size(self, _): + raise qubes.storage.StoragePoolException( + "You shouldn't use volume size setter, use resize method instead") + @property def usage(self): ''' Returns the actualy used space '''