Compare parted output with the dereferenced path

Compare parted output with the dereferenced path of the device as parted
prints that instead of the symlink we called it with.

http://tracker.ceph.com/issues/13438 Fixes: #13438

Signed-off-by: Joe Julian <jjulian@io.com>
This commit is contained in:
Joe Julian 2015-10-09 12:57:06 -07:00
parent 133b0dee86
commit b3c7cb0981

View File

@ -1220,9 +1220,9 @@ def get_free_partition_index(dev):
'BYT;' not in lines):
raise Error('parted output expected to contain one of ' +
'CHH; CYL; or BYT; : ' + lines)
if dev not in lines:
if os.path.realpath(dev) not in lines:
raise Error('parted output expected to contain ' + dev + ': ' + lines)
_, partitions = lines.split(dev)
_, partitions = lines.split(os.path.realpath(dev))
partition_numbers = extract_parted_partition_numbers(partitions)
if partition_numbers:
return max(partition_numbers) + 1