Fix cinder mode backup fail into an infinite loop

When use cinder mode to backup cinder volume which is bigger
than 1G in devstack environment, it will fail into an infinite
loop. It is because the max_file_size in swift.conf is set to
1G by default. This will cause creating image error, and then
cause freezer-agent failure. This patch will catch the exceptions
and fix the issue.

Change-Id: Icee5656a3f187b128313a98918b9c6c9612f66c9
Closes-Bug: #1703373
This commit is contained in:
Pengju Jiao 2017-07-10 21:37:10 +08:00
parent f8060ae001
commit bbe6c15924
1 changed files with 8 additions and 2 deletions

View File

@ -288,9 +288,15 @@ class OSClientManager(object):
LOG.info("Image status: " + image.status)
image = self.get_glance().images.get(image.id)
if image.status in ("killed", "deleted"):
raise Exception("Image have killed state")
raise RuntimeError("Image in killed or deleted state")
except RuntimeError:
if image.status == 'killed':
LOG.info("Delete image in killed state " + image_id)
self.get_glance().images.delete(image_id)
raise
except Exception as e:
if image.status in ("killed", "deleted"):
if hasattr(e, 'code') and e.code == 404:
LOG.warning('Image is not found ' + image_id)
raise
LOG.exception(e)
LOG.warning("Exception getting image status")