From: Sage Weil Date: Tue, 16 Jul 2013 20:14:50 +0000 (-0700) Subject: ceph-disk: rely on /dev/disk/by-partuuid instead of special-casing journal symlinks X-Git-Tag: v0.61.5~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=39bffac6b6c898882d03de392f7f2218933d942b;p=ceph.git ceph-disk: rely on /dev/disk/by-partuuid instead of special-casing journal symlinks This was necessary when ceph-disk-udev didn't create the by-partuuid (and other) symlinks for us, but now it is fragile and error-prone. (It also appears to be broken on a certain customer RHEL VM.) See d7f7d613512fe39ec883e11d201793c75ee05db1. Instead, just use the by-partuuid symlinks that we spent all that ugly effort generating. Backport: cuttlefish Signed-off-by: Sage Weil Reviewed-by: Dan Mick (cherry picked from commit 64379e701b3ed862c05f156539506d3382f77aa8) --- diff --git a/src/ceph-disk b/src/ceph-disk index e13a0c29970..36c75b5d598 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -755,16 +755,6 @@ def zap(dev): raise Error(e) -def get_udev_version(): - version = _check_output( - args=[ - 'udevadm', - '--version', - ], - ) - return int(version) - - def prepare_journal_dev( data, journal, @@ -833,30 +823,9 @@ def prepare_journal_dev( ], ) - if get_udev_version() >= 172: - journal_symlink = '/dev/disk/by-partuuid/{journal_uuid}'.format( - journal_uuid=journal_uuid, - ) - else: - # udev prior to version 172 doesn't create by-partuuid directory - # use by-path symlink instead. This is the third symlink returned - # by udevadm when queried. - LOG.debug('Using alternate persistant name for journal symlink') - symlinks = _check_output( - args=[ - 'udevadm', - 'info', - '--query=symlink', - '--name={name}'.format(name=os.path.basename(journal)), - ], - ) - 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_symlink = '/dev/disk/by-partuuid/{journal_uuid}'.format( + journal_uuid=journal_uuid, + ) journal_dmcrypt = None if journal_dm_keypath: