* changed definition of storage device: only "valid" devices are available now
This commit is contained in:
parent
b5c4eabc26
commit
4f24c813cd
|
@ -254,32 +254,31 @@ class Blockdevice:
|
|||
cached = CACHE.get(cache_link)
|
||||
if not cached is None:
|
||||
return cached
|
||||
result = True
|
||||
|
||||
if self.range > 1:
|
||||
# always check the current state of "result" to skip useless checks
|
||||
if result and (self.range > 1):
|
||||
## partitionable blockdevice
|
||||
CACHE.set(cache_link, False)
|
||||
return False
|
||||
if self.size < MINIMUM_STORAGE_SIZE:
|
||||
result = False
|
||||
if result and not self.is_valid():
|
||||
result = False
|
||||
if result and (self.size < MINIMUM_STORAGE_SIZE):
|
||||
## extended partition, unused loop device
|
||||
CACHE.set(cache_link, False)
|
||||
return False
|
||||
result = False
|
||||
## are we the device mapper of a luks device?
|
||||
if result:
|
||||
for slave in self.slaves:
|
||||
if get_blockdevice(slave, self.sysblock_dir,
|
||||
self.devnode_dir).is_luks():
|
||||
CACHE.set(cache_link, False)
|
||||
return False
|
||||
result = False
|
||||
if result and self.children:
|
||||
## if we are a luks device with exactly one child, then
|
||||
## we are a storage
|
||||
if (len(self.children) == 1) and self.is_luks():
|
||||
CACHE.set(cache_link, True)
|
||||
return True
|
||||
if self.children:
|
||||
if not ((len(self.children) == 1) and self.is_luks()):
|
||||
## a parent blockdevice
|
||||
CACHE.set(cache_link, False)
|
||||
return False
|
||||
CACHE.set(cache_link, True)
|
||||
return True
|
||||
result = False
|
||||
CACHE.set(cache_link, result)
|
||||
return result
|
||||
|
||||
|
||||
def is_partitionable(self):
|
||||
|
|
Loading…
Reference in a new issue