Commit add478b5 authored by Iustin Pop's avatar Iustin Pop
Browse files

lvmstrap: ignore small-sized partitions



This patch changes lvmstrap to ignore “small” partitions. Currently
extended partitions are reported as unused as with a size of 1024
(bytes), and this confuses lvmstrap. Since a very small partition
won't help anyway (below hundred of PE size is not helpful), let's
restrict it to 1GB.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 705ee6df
......@@ -78,6 +78,9 @@ EXCLUDED_FS = frozenset([
"devpts",
])
#: Minimum partition size to be considered (1 GB)
PART_MINSIZE = 1024 * 1024 * 1024
class Error(Exception):
"""Generic exception"""
......@@ -446,8 +449,9 @@ def GetDiskList(opts):
continue
partdev = ReadDev("/sys/block/%s/%s" % (name, partname))
partsize = ReadSize("/sys/block/%s/%s" % (name, partname))
CheckSysDev(partname, partdev)
partitions.append((partname, partsize, partdev))
if partsize >= PART_MINSIZE:
CheckSysDev(partname, partdev)
partitions.append((partname, partsize, partdev))
partitions.sort()
dlist.append((name, size, dev, partitions, inuse))
dlist.sort()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment