Merge "Remove partial image data when filesystem is full"

This commit is contained in:
Jenkins 2012-08-28 23:58:19 +00:00 committed by Gerrit Code Review
commit f57fc69b1b

View File

@ -210,6 +210,11 @@ class Store(glance.store.base.Store):
f.write(buf)
except IOError as e:
if e.errno in [errno.EFBIG, errno.ENOSPC]:
try:
os.unlink(filepath)
except Exception:
msg = _('Unable to remove partial image data for image %s')
LOG.error(msg % image_id)
raise exception.StorageFull()
elif e.errno == errno.EACCES:
raise exception.StorageWriteDenied()