]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume util.system do not 'translate' using realpath
authorAlfredo Deza <adeza@redhat.com>
Tue, 30 Jan 2018 14:22:19 +0000 (09:22 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 7 Feb 2018 14:45:23 +0000 (08:45 -0600)
Using realpath always means that device mapper paths, like for dmcrypt
or LVM will get mangled and will return something like `/dev/dm-1` which
is not useful for anything in ceph-volume

Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 469d01dc1aee8d6528944ef0acec58df868a9da7)

src/ceph-volume/ceph_volume/util/system.py

index dc265e80aac1916960989ca88ace34a13b21a60e..acecc6c8d9b157da8f02225e400c29d70f769c56 100644 (file)
@@ -118,8 +118,6 @@ def path_is_mounted(path, destination=None):
     mounted_locations = mounts.get(realpath, [])
 
     if destination:
-        if destination.startswith('/'):
-            destination = os.path.realpath(destination)
         return destination in mounted_locations
     return mounted_locations != []
 
@@ -130,9 +128,8 @@ def device_is_mounted(dev, destination=None):
     destination exists
     """
     mounts = get_mounts(devices=True)
-    realpath = os.path.realpath(dev) if dev.startswith('/') else dev
     destination = os.path.realpath(destination) if destination else None
-    mounted_locations = mounts.get(realpath, [])
+    mounted_locations = mounts.get(dev, [])
 
     if destination:
         return destination in mounted_locations
@@ -166,7 +163,7 @@ def get_mounts(devices=False, paths=False):
         fields = [as_string(f) for f in line.split()]
         if len(fields) < 3:
             continue
-        device = os.path.realpath(fields[0]) if fields[0].startswith('/') else fields[0]
+        device = fields[0]
         path = os.path.realpath(fields[1])
         # only care about actual existing devices
         if not os.path.exists(device) or not device.startswith('/'):