summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorHans Lindgren <hanlind@kth.se>2013-06-02 00:29:59 +0200
committerHans Lindgren <hanlind@kth.se>2013-06-04 14:09:52 +0200
commitcdf10381caad217ae9eb99c69a4226e40ba81db4 (patch)
tree279d3c0d8c6b5ef0e596e4ffe14a5d134718e7c4 /nova/db
parent5a510518d9e3097730466cfbf4ff25495c4a0302 (diff)
Fix a race where a soft deleted instance might be removed by mistake
When a soft deleted instance is restored there is a tiny risk that it might be deleted if the reclaim periodic task runs at the same time. This happens because the restore operation sets deleted_at to None which makes the reclaim job think it is ok to delete the instance. This can be resolved by restricting reclaims to only those instances whose task_state is None. Resolves bug 1186243. Change-Id: Ia138e2d504b7482c46900583f019a32c70513245
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/sqlalchemy/api.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index 18aa185ab..ffff8efed 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -1728,7 +1728,7 @@ def instance_get_all_by_filters(context, filters, sort_key, sort_dir,
# For other filters that don't match this, we will do regexp matching
exact_match_filter_names = ['project_id', 'user_id', 'image_ref',
'vm_state', 'instance_type_id', 'uuid',
- 'metadata', 'host']
+ 'metadata', 'host', 'task_state']
# Filter the query
query_prefix = exact_filter(query_prefix, models.Instance,