From 3b441ebaad6de8861bccb9904181859256f258e4 Mon Sep 17 00:00:00 2001 From: Bahtiar `kalkin-` Gadimov Date: Thu, 16 Jun 2016 20:01:51 +0200 Subject: [PATCH] Add Storage.outdated_volumes and Pool.is_outdated --- qubes/storage/__init__.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/qubes/storage/__init__.py b/qubes/storage/__init__.py index 64d97329..6d007094 100644 --- a/qubes/storage/__init__.py +++ b/qubes/storage/__init__.py @@ -161,6 +161,21 @@ class Storage(object): volume) self.vm.volumes[name] = volume + @property + def outdated_volumes(self): + ''' Returns a list of outdated volumes ''' + result = [] + if self.vm.is_halted(): + return result + + volumes = self.vm.volumes + for volume in volumes.values(): + pool = self.get_pool(volume) + if pool.is_outdated(volume): + result += [volume] + + return result + def rename(self, old_name, new_name): ''' Notify the pools that the domain was renamed ''' volumes = self.vm.volumes @@ -257,6 +272,10 @@ class Pool(object): raise NotImplementedError("Pool %s has destroy() not implemented" % self.name) + def is_outdated(self, volume): + raise NotImplementedError("Pool %s has is_outdated() not implemented" % + self.name) + def remove(self, volume): ''' Remove volume''' raise NotImplementedError("Pool %s has remove() not implemented" %