From: Sandon Van Ness Date: Wed, 10 Jul 2013 21:55:52 +0000 (-0700) Subject: Get device-by-path by looking for it instead of assuming 3rd entry. X-Git-Tag: v0.67-rc1~116 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=836e35f8ede12dc2e2e811b00099ff5b151adc9b;p=ceph.git Get device-by-path by looking for it instead of assuming 3rd entry. 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 Reviewed-by: Gary Lowell --- diff --git a/src/ceph-disk b/src/ceph-disk index 39fcc4216da0..35e4592ec4d7 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -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: