From: Alfredo Deza Date: Tue, 30 Jan 2018 14:22:19 +0000 (-0500) Subject: ceph-volume util.system do not 'translate' using realpath X-Git-Tag: v12.2.3~19^2~31 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=520200ceea0070a1a14976d06befc72217ed438f;p=ceph.git ceph-volume util.system do not 'translate' using realpath 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 (cherry picked from commit 469d01dc1aee8d6528944ef0acec58df868a9da7) --- diff --git a/src/ceph-volume/ceph_volume/util/system.py b/src/ceph-volume/ceph_volume/util/system.py index dc265e80aac1..acecc6c8d9b1 100644 --- a/src/ceph-volume/ceph_volume/util/system.py +++ b/src/ceph-volume/ceph_volume/util/system.py @@ -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('/'):