Selaa lähdekoodia

storage: add size and usage properties

It's already available in config dict, but lets provide uniform API. And
also it's a bit weird to look for usage data in configuration...

QubesOS/qubes-issues#3240
Marek Marczykowski-Górecki 6 vuotta sitten
vanhempi
commit
7211c7daff
1 muutettua tiedostoa jossa 10 lisäystä ja 0 poistoa
  1. 10 0
      qubesadmin/storage.py

+ 10 - 0
qubesadmin/storage.py

@@ -271,6 +271,16 @@ class Pool(object):
                 l.split('=', 1) for l in pool_info_data.splitlines())
                 l.split('=', 1) for l in pool_info_data.splitlines())
         return self._config
         return self._config
 
 
+    @property
+    def size(self):
+        ''' Storage pool size, in bytes'''
+        return self.config['size']
+
+    @property
+    def usage(self):
+        ''' Space used in the pool, in bytes '''
+        return self.config['usage']
+
     @property
     @property
     def driver(self):
     def driver(self):
         ''' Storage pool driver '''
         ''' Storage pool driver '''