storage/lvm: fix Volume.verify()
This function is supposed to raise an exception if something is wrong, not just return False. Document this.
This commit is contained in:
parent
021047f950
commit
145ccfb34e
@ -276,6 +276,9 @@ class Volume(object):
|
|||||||
def verify(self):
|
def verify(self):
|
||||||
''' Verifies the volume.
|
''' Verifies the volume.
|
||||||
|
|
||||||
|
This function is supposed to either return :py:obj:`True`, or raise
|
||||||
|
an exception.
|
||||||
|
|
||||||
This can be implemented as a coroutine.'''
|
This can be implemented as a coroutine.'''
|
||||||
raise self._not_implemented("verify")
|
raise self._not_implemented("verify")
|
||||||
|
|
||||||
|
@ -455,11 +455,21 @@ class ThinVolume(qubes.storage.Volume):
|
|||||||
|
|
||||||
def verify(self):
|
def verify(self):
|
||||||
''' Verifies the volume. '''
|
''' 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:
|
try:
|
||||||
vol_info = size_cache[self.vid]
|
vol_info = size_cache[vid]
|
||||||
return vol_info['attr'][4] == 'a'
|
if vol_info['attr'][4] != 'a':
|
||||||
|
raise qubes.storage.StoragePoolException(
|
||||||
|
'volume {} not active'.format(vid))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return False
|
raise qubes.storage.StoragePoolException(
|
||||||
|
'volume {} missing'.format(vid))
|
||||||
|
|
||||||
|
|
||||||
def block_device(self):
|
def block_device(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user