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.
This commit is contained in:
Marek Marczykowski-Górecki 2017-12-22 16:52:30 +01:00
parent 3fcae995df
commit 5b0e7123b8
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -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.