Преглед на файлове

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 години
родител
ревизия
7211c7daff
променени са 1 файла, в които са добавени 10 реда и са изтрити 0 реда
  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())
         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
     def driver(self):
         ''' Storage pool driver '''