Skip to content

Commit

Permalink
storage/lvm: check for LVM LV existence and type when creating ThinPool
Browse files Browse the repository at this point in the history
Check if requested thin pool exists and really is thin pool.

QubesOS/qubes-issues#3438
  • Loading branch information
marmarek committed Jan 12, 2018
1 parent 377f331 commit bcf42c1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions qubes/storage/lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ def init_volume(self, vm, volume_config):

def setup(self):
reset_cache()
cache_key = self.volume_group + '/' + self.thin_pool
if cache_key not in size_cache:
raise qubes.storage.StoragePoolException(
'Thin pool {} does not exist'.format(cache_key))
if size_cache[cache_key]['attr'][0] != 't':
raise qubes.storage.StoragePoolException(
'Volume {} is not a thin pool'.format(cache_key))
# TODO Should we create a non existing pool?

def get_volume(self, vid):
Expand Down

0 comments on commit bcf42c1

Please sign in to comment.