storage/file: gracefully handle not mounted pool
Fixes QubesOS/qubes-issues#4668
This commit is contained in:
parent
27a0fe25ab
commit
318ed439ff
@ -155,13 +155,19 @@ class FilePool(qubes.storage.Pool):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def size(self):
|
def size(self):
|
||||||
statvfs = os.statvfs(self.dir_path)
|
try:
|
||||||
return statvfs.f_frsize * statvfs.f_blocks
|
statvfs = os.statvfs(self.dir_path)
|
||||||
|
return statvfs.f_frsize * statvfs.f_blocks
|
||||||
|
except FileNotFoundError:
|
||||||
|
return 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def usage(self):
|
def usage(self):
|
||||||
statvfs = os.statvfs(self.dir_path)
|
try:
|
||||||
return statvfs.f_frsize * (statvfs.f_blocks - statvfs.f_bfree)
|
statvfs = os.statvfs(self.dir_path)
|
||||||
|
return statvfs.f_frsize * (statvfs.f_blocks - statvfs.f_bfree)
|
||||||
|
except FileNotFoundError:
|
||||||
|
return 0
|
||||||
|
|
||||||
def included_in(self, app):
|
def included_in(self, app):
|
||||||
''' Check if there is pool containing this one - either as a
|
''' Check if there is pool containing this one - either as a
|
||||||
|
Loading…
Reference in New Issue
Block a user