From 4fab29c1c5e4dec79f089e9803adf0e855e5ec4f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 21 May 2013 12:52:03 -0700 Subject: [PATCH] ceph-disk: fix stat errors with new suppress code Broken by 225fefe5e7c997b365f481b6c4f66312ea28ed61. Signed-off-by: Sage Weil (cherry picked from commit bcc8bfdb672654c6a6b48a2aa08267a894debc32) --- src/ceph-disk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ceph-disk b/src/ceph-disk index 3c105463ed866..54c9445045a65 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -1820,9 +1820,9 @@ SUPPRESS_PREFIX='/var/lib/ceph/tmp/suppress-activate.' def is_suppressed(path): disk = os.path.realpath(path) - if not disk.startswith('/dev/') or not stat.S_ISBLK(os.lstat(path)): - return False try: + if not disk.startswith('/dev/') or not stat.S_ISBLK(os.lstat(path).st_mode): + return False base = disk[5:] while len(base): if os.path.exists(SUPPRESS_PREFIX + base): @@ -1835,7 +1835,7 @@ def set_suppress(path): disk = os.path.realpath(path) if not os.path.exists(disk): raise Error('does not exist', path); - if not stat.S_ISBLK(os.lstat(path)): + if not stat.S_ISBLK(os.lstat(path).st_mode): raise Error('not a block device', path) base = disk[5:] @@ -1847,7 +1847,7 @@ def unset_suppress(path): disk = os.path.realpath(path) if not os.path.exists(disk): raise Error('does not exist', path); - if not stat.S_ISBLK(os.lstat(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:] -- 2.39.5