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:
		
							parent
							
								
									377f331d52
								
							
						
					
					
						commit
						bcf42c13fa
					
				@ -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):
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user