]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: rely on /dev/disk/by-partuuid instead of special-casing journal symlinks
authorSage Weil <sage@inktank.com>
Tue, 16 Jul 2013 20:14:50 +0000 (13:14 -0700)
committerSage Weil <sage@inktank.com>
Tue, 16 Jul 2013 22:14:52 +0000 (15:14 -0700)
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 <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
(cherry picked from commit 64379e701b3ed862c05f156539506d3382f77aa8)

src/ceph-disk

index e13a0c299704a09f62546adc58efe173136da61b..36c75b5d598111597a7ab933acca5fb3f7e9841a 100755 (executable)
@@ -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: