storage/lvm: check for LVM LV existence and type when creating ThinPool

Check if requested thin pool exists and really is thin pool.

QubesOS/qubes-issues#3438
This commit is contained in:
Marek Marczykowski-Górecki 2018-01-12 05:12:08 +01:00
parent 377f331d52
commit bcf42c13fa
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -98,6 +98,13 @@ class ThinPool(qubes.storage.Pool):
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):