summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@yahoo.com>2010-09-12 17:56:28 -0700
committerVishvananda Ishaya <vishvananda@yahoo.com>2010-09-12 17:56:28 -0700
commitcb2a28d82210e43a221a8fa8f2a03a7dbd6e8779 (patch)
treea291760a10b2e542bdfee7b5f81619c13222a302
parentefeb5243ffd5e588748d8786ac82a04e302f0612 (diff)
downloadnova-cb2a28d82210e43a221a8fa8f2a03a7dbd6e8779.tar.gz
nova-cb2a28d82210e43a221a8fa8f2a03a7dbd6e8779.tar.xz
nova-cb2a28d82210e43a221a8fa8f2a03a7dbd6e8779.zip
speed up the query and make sure allocated is false
-rw-r--r--nova/db/sqlalchemy/api.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index aa8670253..ca5e12f95 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -258,9 +258,10 @@ def fixed_ip_disassociate_all_by_timeout(_context, host, time):
'INNER JOIN networks '
'ON fixed_ips.network_id = '
'networks.id '
- 'WHERE host = :host) as x) '
- 'AND updated_at < :time '
- 'AND instance_id IS NOT NULL',
+ 'WHERE networks.host = :host '
+ 'AND fixed_ip.updated_at < :time '
+ 'AND fixed_ip.instance_id IS NOT NULL'
+ 'AND fixed_ip.allocated = 0) as x) ',
{'host': host,
'time': time.isoformat()})
return result.rowcount