]> git-server-git.apps.pok.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:25 +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 39fcc4216da09bcfd68c91795067e29e65b43ace..35e4592ec4d76a9433f54b93c586e17a36234f74 100755 (executable)
@@ -857,7 +857,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: