Catch exceptions from backup runner

The backup runner context manager may throw BackupErrors.
The backupagent currently only checks for the success of the storage
save action and any exceptions, but not those from the runner
__enter__/__exit__ methods.

This issue was discovered when fixing backup unittests
in change: 312611
The unittests assert that the backup would be marked as FAILED, but
was marked as COMPLETED instead.

This patch just moves the 'with clause' of the backup runner to the
try-except block to intercept any exceptions originating from
the backup procedures.

Change-Id: I27d0cf1b9a174ca69eb82d26f14a4c0d03f75382
Partial-Bug: 1544522
This commit is contained in:
Petr Malik 2016-05-27 12:55:25 -04:00 committed by stewie925
parent c45eb67018
commit 3edcd5cdcf

View File

@ -76,9 +76,9 @@ class BackupAgent(object):
**backup_state)
LOG.debug("Updated state for %s to %s.", backup_id, backup_state)
try:
with runner(filename=backup_id, extra_opts=extra_opts,
**parent_metadata) as bkup:
try:
LOG.debug("Starting backup %s.", backup_id)
success, note, checksum, location = storage.save(
bkup.manifest,