]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Get device-by-path by looking for it instead of assuming 3rd entry.
authorSandon Van Ness <sandon@inktank.com>
Wed, 10 Jul 2013 21:55:52 +0000 (14:55 -0700)
committerSandon Van Ness <sandon@inktank.com>
Wed, 10 Jul 2013 22:06:13 +0000 (15:06 -0700)
On some systems (virtual machines so far) the device-by-path entry
from udevadm is not always in the same spot so instead actually
look for the right output instead of blindy assuming that its a
specific field in the output.

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
Reviewed-by: Gary Lowell <gary.lowell@inktank.com>
src/ceph-disk

index e77a8560ec20d17f7e7149f696e19ef1524f1cb8..e13a0c299704a09f62546adc58efe173136da61b 100755 (executable)
@@ -850,7 +850,13 @@ def prepare_journal_dev(
                     '--name={name}'.format(name=os.path.basename(journal)),
                     ],
                 )   
-            journal_symlink = '/dev/{symlink}-part{num}'.format(symlink=str(symlinks).split()[2], num=num)
+            journal_symlink = None
+            for udev_line in symlinks.split():
+                if 'by-path' in udev_line:
+                    journal_symlink = '/dev/{symlink}-part{num}'.format(symlink=str(udev_line), num=num)
+                    break
+            if not journal_symlink:
+               raise Error('Unable to get device by path from udev')
 
         journal_dmcrypt = None
         if journal_dm_keypath: