Parcourir la source

storage: add volume.is_outdated() function

This is to match core-admin API. Logically it could be a property not a
method (as other things like usage or size), but it is already defined
(and used in various places) as a method in core-admin, so lets don't
change the API right now.
Marek Marczykowski-Górecki il y a 6 ans
Parent
commit
5b0e7123b8
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  1. 7 0
      qubesadmin/storage.py

+ 7 - 0
qubesadmin/storage.py

@@ -171,6 +171,13 @@ class Volume(object):
         self._fetch_info()
         return int(self._info['revisions_to_keep'])
 
+    def is_outdated(self):
+        ''' Returns `True` if this snapshot of a source volume (for
+        `snap_on_start`=True) is outdated.
+        '''
+        self._fetch_info(True)
+        return self._info.get('is_outdated', False) == 'True'
+
     def resize(self, size):
         '''Resize volume.