summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandon Van Ness <sandon@inktank.com>2013-07-10 14:55:52 -0700
committerSandon Van Ness <sandon@inktank.com>2013-07-10 15:06:13 -0700
commite537699b33f84c14f027b56372fbcb0a99bbe88d (patch)
treee1dbe74e73b01a7b0d72214d0557873051f071ce
parent78f226634bd80f6678b1f74ccf785bc52fcd6b62 (diff)
downloadceph-e537699b33f84c14f027b56372fbcb0a99bbe88d.tar.gz
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 <sandon@inktank.com> Reviewed-by: Gary Lowell <gary.lowell@inktank.com>
-rwxr-xr-xsrc/ceph-disk8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ceph-disk b/src/ceph-disk
index e77a8560ec2..e13a0c29970 100755
--- a/src/ceph-disk
+++ b/src/ceph-disk
@@ -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: