From c686033348e7e90f9ef841552817bf9f07313310 Mon Sep 17 00:00:00 2001 From: Darja Shakhray Date: Fri, 29 Jan 2016 13:22:48 +0300 Subject: [PATCH] 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 --- glance/db/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glance/db/__init__.py b/glance/db/__init__.py index fb05e62015..524ff5c80a 100644 --- a/glance/db/__init__.py +++ b/glance/db/__init__.py @@ -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)