[NEW PATCH] BZ#725963 - Fix error handling in isBlockDevice() (via gerrit-bot)

Saggi Mizrahi smizrahi at redhat.com
Wed Jul 27 07:47:52 UTC 2011


New patch submitted by Saggi Mizrahi (smizrahi at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/749

commit 654681f63df38137cadf09d08182b2cbfa45f883
Author: Saggi Mizrahi <smizrahi at redhat.com>
Date:   Wed Jul 27 10:43:30 2011 +0300

    BZ#725963 - Fix error handling in isBlockDevice()
    
    Change-Id: I9f519354e7fec56a85ef908765d33e7b92ad82bb

diff --git a/vdsm/storage/devicemapper.py b/vdsm/storage/devicemapper.py
index 8873fbd..76d31a3 100644
--- a/vdsm/storage/devicemapper.py
+++ b/vdsm/storage/devicemapper.py
@@ -70,15 +70,18 @@ def resolveDevName(devName):
     try:
         return getDmId(devName)
     except Exception:
-        raise OSError(errno.ENOENT, "No such multipath device `%s`" % devName)
+        raise OSError(errno.ENOENT, "No such block device `%s`" % devName)
 
 def isVirtualDevice(devName):
     devName = resolveDevName(devName)
     return os.path.exists(os.path.join("/sys/devices/virtual/block/", devName))
 
 def isBlockDevice(devName):
-    devName = resolveDevName(devName)
-    return os.path.exists(os.path.join("/sys/block/", devName))
+    try:
+        devName = resolveDevName(devName)
+        return os.path.exists(os.path.join("/sys/block/", devName))
+    except OSError:
+        return False
 
 
 def getAllSlaves():




More information about the vdsm-patches mailing list