|
|
|
@ -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?
|
|
|
|
|
for slave in self.slaves:
|
|
|
|
|
if get_blockdevice(slave, self.sysblock_dir,
|
|
|
|
|
self.devnode_dir).is_luks():
|
|
|
|
|
CACHE.set(cache_link, False)
|
|
|
|
|
return False
|
|
|
|
|
## 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:
|
|
|
|
|
## a parent blockdevice
|
|
|
|
|
CACHE.set(cache_link, False)
|
|
|
|
|
return False
|
|
|
|
|
CACHE.set(cache_link, True)
|
|
|
|
|
return True
|
|
|
|
|
if result:
|
|
|
|
|
for slave in self.slaves:
|
|
|
|
|
if get_blockdevice(slave, self.sysblock_dir,
|
|
|
|
|
self.devnode_dir).is_luks():
|
|
|
|
|
result = False
|
|
|
|
|
if result and self.children:
|
|
|
|
|
## if we are a luks device with exactly one child, then
|
|
|
|
|
## we are a storage
|
|
|
|
|
if not ((len(self.children) == 1) and self.is_luks()):
|
|
|
|
|
## a parent blockdevice
|
|
|
|
|
result = False
|
|
|
|
|
CACHE.set(cache_link, result)
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def is_partitionable(self):
|
|
|
|
|