Project

General

Profile

Actions

Tasks #71469

open
RD RD

mgr/vol: improve readability in exception handling part of remove_subvolume

Tasks #71469: mgr/vol: improve readability in exception handling part of remove_subvolume

Added by Rishabh Dave over 1 year ago. Updated over 1 year ago.

Status:
Fix Under Review
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Due date:
% Done:

0%

Reviewed:
Affected Versions:
Component(FS):
mgr/volumes
Labels (FS):
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

Following elif clause is where readability can be improved -

        except VolumeException as ve:
            if ve.errno == -errno.EAGAIN and not force:
                ve = VolumeException(ve.errno, ve.error_str + " (use --force to override)")
                ret = self.volume_exception_to_retval(ve)
            elif not (ve.errno == -errno.ENOENT and force):
                ret = self.volume_exception_to_retval(ve)
        return ret

If (ve.errno -errno.ENOENT and force) is True, ret remains initiated to its default value (which is 0) and thus zero is returned. Neither we inform user why zero is retuned in this case and checking for boolean value of not (ve.errno -errno.ENOENT and force) makes code a bit complicated.

RD Updated by Rishabh Dave over 1 year ago Actions #1

  • Component(FS) mgr/volumes added

RD Updated by Rishabh Dave over 1 year ago Actions #2

  • Description updated (diff)

RD Updated by Rishabh Dave over 1 year ago Actions #3

  • Subject changed from mgr/vol: remove_subvolume can return zero even though exception was raised to mgr/vol: improve readability in exception handling part of remove_subvolume
  • Description updated (diff)

RD Updated by Rishabh Dave over 1 year ago Actions #4

  • Tracker changed from Bug to Tasks
  • Regression deleted (No)
  • Severity deleted (3 - minor)

RD Updated by Rishabh Dave over 1 year ago Actions #5

  • Status changed from In Progress to Fix Under Review
  • Pull request ID set to 63554
Actions

Also available in: PDF Atom