From 5e7fd2584ad8b20635d284bbe448e45a59c37792 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Sat, 10 Mar 2012 22:49:29 +0000 Subject: Remove update lockmode from compute_node_get_by_host Fixes bug #948066 This commit removes the usage of an update cursor so postgres doesn't raise the error below SELECT FOR UPDATE/SHARE cannot be applied to the nullable side of an outer join Change-Id: Ia1ede22df38d5f6a24372e0ad8ec25151ad195c7 --- nova/db/sqlalchemy/api.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index de8e8dad0..e0d6647da 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -518,10 +518,6 @@ def compute_node_update(context, compute_id, values, auto_adjust): compute_ref.save(session=session) -# Note: these operations use with_lockmode() ... so this will only work -# reliably with engines that support row-level locking -# (postgres, mysql+innodb and above). - def compute_node_get_by_host(context, host): """Get all capacity entries for the given host.""" session = get_session() @@ -529,11 +525,14 @@ def compute_node_get_by_host(context, host): node = session.query(models.ComputeNode).\ options(joinedload('service')).\ filter(models.Service.host == host).\ - filter_by(deleted=False).\ - with_lockmode('update') + filter_by(deleted=False) return node.first() +# Note: these operations use with_lockmode() ... so this will only work +# reliably with engines that support row-level locking +# (postgres, mysql+innodb and above). + def compute_node_capacity_find(context, minimum_ram_mb, minimum_disk_gb): """Get all enabled hosts with enough ram and disk.""" session = get_session() -- cgit