]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Compare parted output with the dereferenced path
authorJoe Julian <jjulian@io.com>
Fri, 9 Oct 2015 19:57:06 +0000 (12:57 -0700)
committerJoe Julian <jjulian@io.com>
Wed, 18 Nov 2015 20:08:34 +0000 (12:08 -0800)
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>
src/ceph-disk

index 39a235683023cf0c0dd8f79b6efcc32362a97166..7f4a00988f314d3633d55f7fb3b240e6768f5e72 100755 (executable)
@@ -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