Fix update all props when you delete image

Fix update all props when you delete an image from the database.
Extra updating image increases the load on the db.
Added update status to 'deleted' or 'pending_delete'.

Closes-bug: #1539006

Change-Id: If58862139ad8a3a45cdb5d3e84eca6358d40608b
This commit is contained in:
Darja Shakhray 2016-01-29 13:22:48 +03:00
parent 9a6a4807aa
commit c686033348
1 changed files with 2 additions and 2 deletions

View File

@ -283,10 +283,10 @@ class ImageRepo(object):
image.updated_at = new_values['updated_at']
def remove(self, image):
image_values = self._format_image_to_db(image)
try:
self.db_api.image_update(self.context, image.image_id,
image_values, purge_props=True)
{'status': image.status},
purge_props=True)
except (exception.ImageNotFound, exception.Forbidden):
msg = _("No image found with ID %s") % image.image_id
raise exception.ImageNotFound(msg)