Remove partial image data when filesystem is full
When an image is uploaded that fills up the local filesystem, attempt to delete the created file. This only applies to the 'filesystem' store driver. Fixes bug 1019421 Change-Id: Ie12d736f3efb29b0862fef2899a1d2c142def38e
This commit is contained in:
parent
32584bed6c
commit
37d1c1d83c
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user