diff --git a/qubes/storage/__init__.py b/qubes/storage/__init__.py index 5bc5f1a9..12853fb2 100644 --- a/qubes/storage/__init__.py +++ b/qubes/storage/__init__.py @@ -276,6 +276,9 @@ class Volume(object): def verify(self): ''' Verifies the volume. + This function is supposed to either return :py:obj:`True`, or raise + an exception. + This can be implemented as a coroutine.''' raise self._not_implemented("verify") diff --git a/qubes/storage/lvm.py b/qubes/storage/lvm.py index e67b0ccf..b8acbb5d 100644 --- a/qubes/storage/lvm.py +++ b/qubes/storage/lvm.py @@ -455,11 +455,21 @@ class ThinVolume(qubes.storage.Volume): def verify(self): ''' Verifies the volume. ''' + if not self.save_on_stop and not self.snap_on_start: + # volatile volumes don't need any files + return True + if self.source is not None: + vid = str(self.source) + else: + vid = self.vid try: - vol_info = size_cache[self.vid] - return vol_info['attr'][4] == 'a' + vol_info = size_cache[vid] + if vol_info['attr'][4] != 'a': + raise qubes.storage.StoragePoolException( + 'volume {} not active'.format(vid)) except KeyError: - return False + raise qubes.storage.StoragePoolException( + 'volume {} missing'.format(vid)) def block_device(self):