]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: fix stat errors with new suppress code
authorSage Weil <sage@inktank.com>
Tue, 21 May 2013 19:52:03 +0000 (12:52 -0700)
committerSage Weil <sage@inktank.com>
Fri, 14 Jun 2013 21:08:51 +0000 (14:08 -0700)
Broken by 225fefe5e7c997b365f481b6c4f66312ea28ed61.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit bcc8bfdb672654c6a6b48a2aa08267a894debc32)

src/ceph-disk

index 3c105463ed866db844ae77b8523a074acdf57124..54c9445045a6500f6ec2753cb71c2401bf9bc6d5 100755 (executable)
@@ -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:]