Refactor the usage of save_and_reraise_exception

Instead assigning the reraise flag as False in the exception
context, we'd better set it to False initially while
calling the save_and_reraise_exception().

Change-Id: I9e49c36003256ab77f2635a1c41d2cc2ebc84814
This commit is contained in:
xiexs 2016-08-14 22:18:33 -04:00
parent 15d2229d72
commit 49ed717dd2
1 changed files with 3 additions and 6 deletions

View File

@ -191,8 +191,7 @@ class FalconstorBaseDriver(san.SanDriver):
try:
self.proxy.delete_vdev(volume)
except rest_proxy.FSSHTTPError as err:
with excutils.save_and_reraise_exception() as ctxt:
ctxt.reraise = False
with excutils.save_and_reraise_exception(reraise=False):
LOG.warning(_LW("Volume deletion failed with message: %s"),
err.reason)
@ -208,8 +207,7 @@ class FalconstorBaseDriver(san.SanDriver):
try:
self.proxy.delete_snapshot(snapshot)
except rest_proxy.FSSHTTPError as err:
with excutils.save_and_reraise_exception() as ctxt:
ctxt.reraise = False
with excutils.save_and_reraise_exception(reraise=False):
LOG.error(
_LE("Snapshot deletion failed with message: %s"),
err.reason)
@ -226,8 +224,7 @@ class FalconstorBaseDriver(san.SanDriver):
extend_volume_name = self.proxy._get_fss_volume_name(volume)
self.proxy.extend_vdev(extend_volume_name, snap_size, vol_size)
except rest_proxy.FSSHTTPError as err:
with excutils.save_and_reraise_exception() as ctxt:
ctxt.reraise = False
with excutils.save_and_reraise_exception(reraise=False):
LOG.error(_LE(
"Resizing %(id)s failed with message: %(msg)s. "
"Cleaning volume."), {'id': volume["id"],