Eduardo has uploaded a new change for review.
Change subject: More precise exception when multipath failed. ......................................................................
More precise exception when multipath failed.
In spite that any OSError is translated to ENODEV in devicemapper, the complete info is needed.
Related to BZ#965184.
Change-Id: I1b87e8e91b838db2c8a98c9afbbc998e8f4c792a Signed-off-by: Eduardo ewarszaw@redhat.com --- M vdsm/storage/devicemapper.py 1 file changed, 4 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/17145/1
diff --git a/vdsm/storage/devicemapper.py b/vdsm/storage/devicemapper.py index 451c736..ff1fb7a 100644 --- a/vdsm/storage/devicemapper.py +++ b/vdsm/storage/devicemapper.py @@ -34,11 +34,10 @@ devlinkPath = DMPATH_FORMAT % deviceMultipathName try: devStat = os.stat(devlinkPath) - except OSError: - raise OSError(errno.ENODEV, "Could not find dm device named `%s`" % - deviceMultipathName) - - return "dm-%d" % os.minor(devStat.st_rdev) + except OSError as e: + raise OSError(errno.ENODEV, "%s: %s" % (deviceMultipathName, e)) + else: + return "dm-%d" % os.minor(devStat.st_rdev)
def findDev(major, minor):
oVirt Jenkins CI Server has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/2588/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/3395/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/3479/ : SUCCESS
Yeela Kaplan has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 1: Looks good to me, but someone else must approve
Ayal Baron has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 1: (1 inline comment)
.................................................... File vdsm/storage/devicemapper.py Line 34: devlinkPath = DMPATH_FORMAT % deviceMultipathName Line 35: try: Line 36: devStat = os.stat(devlinkPath) Line 37: except OSError as e: Line 38: raise OSError(errno.ENODEV, "%s: %s" % (deviceMultipathName, e)) e contains a lot more than just the message. Need to take only e.message Line 39: else: Line 40: return "dm-%d" % os.minor(devStat.st_rdev) Line 41: Line 42:
Eduardo has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 1: (1 inline comment)
.................................................... File vdsm/storage/devicemapper.py Line 34: devlinkPath = DMPATH_FORMAT % deviceMultipathName Line 35: try: Line 36: devStat = os.stat(devlinkPath) Line 37: except OSError as e: Line 38: raise OSError(errno.ENODEV, "%s: %s" % (deviceMultipathName, e))
try:
os.stat("nada")
except OSError as e:
s = "%s" % (e,)
t = "%s" % (e.message,)
s
"[Errno 2] No such file or directory: 'nada'"
t
'' Line 39: else: Line 40: return "dm-%d" % os.minor(devStat.st_rdev) Line 41: Line 42:
oVirt Jenkins CI Server has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/2698/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/3505/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/3589/ : SUCCESS
Ayal Baron has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 3: I would prefer that you didn't submit this
(2 inline comments)
.................................................... File vdsm/storage/devicemapper.py Line 34: devlinkPath = DMPATH_FORMAT % deviceMultipathName Line 35: try: Line 36: devStat = os.stat(devlinkPath) Line 37: except OSError as e: Line 38: raise OSError(e.errno, "%s: %s: %s" % if you don't even keep the logic of raising ENODEV specifically (which was what you did do in the first patch set) then why catch here at all? why is it suddenly ok to raise whatever is returned? Line 39: (deviceMultipathName, e.strerror, e.filename)) Line 40: else: Line 41: return "dm-%d" % os.minor(devStat.st_rdev) Line 42:
Line 75: Line 76: Line 77: def resolveDevName(devName): Line 78: try: Line 79: resolved = getSysfsPath(devName) you're changing the interface here (returning /sys/block/devName instead of devName). Why is that ok? Line 80: except OSError as e: Line 81: if e.errno == errno.ENOENT: Line 82: resolved = getDmId(devName) Line 83: else:
Eduardo has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 3: (1 inline comment)
.................................................... File vdsm/storage/devicemapper.py Line 34: devlinkPath = DMPATH_FORMAT % deviceMultipathName Line 35: try: Line 36: devStat = os.stat(devlinkPath) Line 37: except OSError as e: Line 38: raise OSError(e.errno, "%s: %s: %s" % Because the ENODEV is not especially honored anywhere, all the errors are the same.
Catching and re-raising to add deviceMultipathName (input) to the error string which includes only (claculated) devLinkPath. Line 39: (deviceMultipathName, e.strerror, e.filename)) Line 40: else: Line 41: return "dm-%d" % os.minor(devStat.st_rdev) Line 42:
oVirt Jenkins CI Server has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 4:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/2720/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/3527/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/3611/ : SUCCESS
Ayal Baron has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 4: Code-Review+2
g
Yeela Kaplan has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 4: Code-Review+1
Saggi Mizrahi has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 4: Code-Review+1
Itamar Heim has posted comments on this change.
Change subject: More precise exception when multipath failed. ......................................................................
Patch Set 4:
ping?
Itamar Heim has abandoned this change.
Change subject: More precise exception when multipath failed. ......................................................................
Abandoned
abandoning per no reply. please restore if still relevant.
vdsm-patches@lists.fedorahosted.org