Fix unsaved exception in backup/drivers

When an exception occurs during exception handling, it loses the
information of the first exception.

We should use the excutils.save_and_reraise_exception() in some cases.

Change-Id: I5d0ea53ba6c52138c71cca61aedbdf06338f2a7d
Closes-Bug: #1292380
This commit is contained in:
KIYOHIRO ADACHI
2014-03-14 16:04:57 +09:00
parent d63f4beda8
commit 3f67de92cf
4 changed files with 220 additions and 20 deletions

View File

@@ -41,6 +41,7 @@ from oslo.config import cfg
from cinder.backup.driver import BackupDriver
from cinder import exception
from cinder.openstack.common import excutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import timeutils
from cinder.openstack.common import units
@@ -349,10 +350,11 @@ class SwiftBackupDriver(BackupDriver):
try:
self._backup_metadata(backup, object_meta)
except Exception as err:
LOG.exception(_("Backup volume metadata to swift failed: %s")
% six.text_type(err))
self.delete(backup)
raise
with excutils.save_and_reraise_exception():
LOG.exception(
_("Backup volume metadata to swift failed: %s") %
six.text_type(err))
self.delete(backup)
self._finalize_backup(backup, container, object_meta)