diff options
| author | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-09-12 17:56:28 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-09-12 17:56:28 -0700 |
| commit | cb2a28d82210e43a221a8fa8f2a03a7dbd6e8779 (patch) | |
| tree | a291760a10b2e542bdfee7b5f81619c13222a302 | |
| parent | efeb5243ffd5e588748d8786ac82a04e302f0612 (diff) | |
| download | nova-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.py | 7 |
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 |
