]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Compare parted output with the dereferenced path 7176/head
authorJoe Julian <jjulian@io.com>
Fri, 9 Oct 2015 19:57:06 +0000 (12:57 -0700)
committerLoic Dachary <ldachary@redhat.com>
Mon, 11 Jan 2016 09:44:44 +0000 (10:44 +0100)
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>
(cherry picked from commit b3c7cb098195111b9c642e5a9b726b63717f2e0d)

src/ceph-disk

index 4a485201a4fe59c65b7e9da9210b2b0bcf3387e1..a32200cd3076bc84ede40d95f1a0803a2ae1b122 100755 (executable)
@@ -996,9 +996,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