diff options
author | Sage Weil <sage@inktank.com> | 2013-07-03 11:01:39 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-16 15:51:44 -0700 |
commit | 3359aaedde838c98d1155611e157fd2da9e8b9f5 (patch) | |
tree | 86f1ec1f4e20b048a5c8a8d52e45219a1331d47f | |
parent | 35d3f2d84808efda3d2ac868afe03e6959d51c03 (diff) | |
download | ceph-3359aaedde838c98d1155611e157fd2da9e8b9f5.tar.gz |
ceph-disk: use get_dev_name() helper throughout
This is more robust than the broken split trick.
Signed-off-by: Sage Weil <sage@inktank.com>
-rwxr-xr-x | src/ceph-disk | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ceph-disk b/src/ceph-disk index 4ad4ccc5d9a..d088bcc60f4 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -298,7 +298,7 @@ def is_held(dev): """ assert os.path.exists(dev) dev = os.path.realpath(dev) - base = dev.split('/')[-1] + base = get_dev_name(dev) # full disk? directory = '/sys/block/{base}/holders'.format(base=base) @@ -1990,7 +1990,7 @@ def is_suppressed(path): try: if not disk.startswith('/dev/') or not stat.S_ISBLK(os.lstat(path).st_mode): return False - base = disk.split('/')[-1] + base = get_dev_name(disk) while len(base): if os.path.exists(SUPPRESS_PREFIX + base): return True @@ -2004,7 +2004,7 @@ def set_suppress(path): raise Error('does not exist', path) if not stat.S_ISBLK(os.lstat(path).st_mode): raise Error('not a block device', path) - base = disk.split('/')[-1] + base = get_dev_name(disk) with file(SUPPRESS_PREFIX + base, 'w') as f: pass @@ -2017,7 +2017,7 @@ def unset_suppress(path): if not stat.S_ISBLK(os.lstat(path).st_mode): raise Error('not a block device', path) assert disk.startswith('/dev/') - base = disk.split('/')[-1] + base = get_dev_name(disk) fn = SUPPRESS_PREFIX + base if not os.path.exists(fn): |