From f1cf1de00f9dfb211b962246e743b90620db8c0d Mon Sep 17 00:00:00 2001 From: Chris Friesen Date: Fri, 3 Mar 2017 14:26:48 -0600 Subject: [PATCH] Add comment to instance_destroy() The instance_actions and instance_actions_events tables are handled differently than most when we soft-delete an instance. It's not immediately obvious why this is, so let's add a comment explaining what's going on. Change-Id: Ie353650861c2911e4f55628c55f049fc1756e591 --- nova/db/sqlalchemy/api.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index b11157d33989..01e9a6473d41 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -1885,6 +1885,11 @@ def instance_destroy(context, instance_uuid, constraint=None): resource_id=instance_uuid).delete() context.session.query(models.ConsoleAuthToken).filter_by( instance_uuid=instance_uuid).delete() + # NOTE(cfriesen): We intentionally do not soft-delete entries in the + # instance_actions or instance_actions_events tables because they + # can be used by operators to find out what actions were performed on a + # deleted instance. Both of these tables are special-cased in + # _archive_deleted_rows_for_table(). return instance_ref