diff options
author | Sage Weil <sage@inktank.com> | 2013-06-18 16:21:48 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-24 15:46:37 -0700 |
commit | f46dbc462f623e9ab6c00394abb4d890e5d90890 (patch) | |
tree | 305ea0a399e872c8d6c594e5b0cc22e8cf32500c | |
parent | f799dac7bdf7cf0824a177131473cf59ef3c5205 (diff) | |
download | ceph-f46dbc462f623e9ab6c00394abb4d890e5d90890.tar.gz |
ceph-disk: handle /dev/foo/bar devices throughout
Assume the last component is the unique device name, even if it appears
under a subdir of /dev.
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit cb97338b1186939deecb78e9d949c38c3ef59026)
-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 643eb588a40..cb9d510cf97 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -288,7 +288,7 @@ def is_held(dev): """ assert os.path.exists(dev) dev = os.path.realpath(dev) - base = dev[5:] + base = dev.split('/')[-1] # full disk? directory = '/sys/block/{base}/holders'.format(base=base) @@ -1978,7 +1978,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[5:] + base = disk.split('/')[-1] while len(base): if os.path.exists(SUPPRESS_PREFIX + base): return True @@ -1992,7 +1992,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[5:] + base = disk.split('/')[-1] with file(SUPPRESS_PREFIX + base, 'w') as f: pass @@ -2005,7 +2005,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[5:] + base = disk.split('/')[-1] fn = SUPPRESS_PREFIX + base if not os.path.exists(fn): |