From 1efc940b041b602267fa391a388a2da50e246491 Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Wed, 29 May 2013 14:21:00 +0000 Subject: [PATCH] Don't delete sys_meta on instance delete Unfortunately, we require to access instance_system_metadata to get data (specifically at least instance_type data) for instances that have been deleted. There's 2 cases where this is true: 1) nova-api supports showing deleting instances when you specify a 'changes-since' param. 2) The _usage_audit_log periodic task pulls all instances during the audit period, which includes instances that have been deleted during that period. This reverts commit 17bca438954638d74035d560e826a26a532b3ea3, which was attempting to fix a bug where we leave instance_system_metadata entries undeleted from the DB. There's not an easy way to query for the deleted sys_meta data in an efficient manner, and leaving the entries undeleted is the lesser of the 2 evils for now. Fixes bug 1185190 Change-Id: I898f0546c49126dcc56a4237120082f95dc82304 --- nova/tests/test_db_api.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py index c6a8e779..f3ddbcc1 100644 --- a/nova/tests/test_db_api.py +++ b/nova/tests/test_db_api.py @@ -459,7 +459,7 @@ class DbApiTestCase(DbTestCase): system_meta = db.instance_system_metadata_get(ctxt, instance['uuid']) self.assertEqual('baz', system_meta['original_image_ref']) - def test_delete_instance_and_system_metadata_on_instance_destroy(self): + def test_delete_instance_metadata_on_instance_destroy(self): ctxt = context.get_admin_context() # Create an instance with some metadata @@ -471,11 +471,8 @@ class DbApiTestCase(DbTestCase): self.assertEqual('meow', instance_meta['key1']) db.instance_destroy(ctxt, instance['uuid']) instance_meta = db.instance_metadata_get(ctxt, instance['uuid']) - instance_system_meta = db.instance_system_metadata_get(ctxt, - instance['uuid']) - # Make sure instance and system metadata is deleted as well + # Make sure instance metadata is deleted as well self.assertEqual({}, instance_meta) - self.assertEqual({}, instance_system_meta) def test_instance_update_unique_name(self): otherprojectcontext = context.RequestContext(self.user_id,