Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make fixed_ip_disassociate_all_by_timeout work.
Fix an issue in the SQL api where fixed_ip_disassociate_all_by_timeout
was getting an array of tuples instead of IDs from a model_query.

This should resolves issues where fixed IPs don't get dissassociated
via the network managers periodic task.

Fixes LP Bug #953708.

Change-Id: Iac485cdcda072ee248237e6c4a31113685f5b980
  • Loading branch information
dprince committed Mar 13, 2012
1 parent 094985e commit f48f1bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nova/db/sqlalchemy/api.py
Expand Up @@ -1015,16 +1015,17 @@ def fixed_ip_disassociate_all_by_timeout(context, host, time):
host_filter = or_(and_(models.Instance.host == host,
models.Network.multi_host == True),
models.Network.host == host)
fixed_ips = model_query(context, models.FixedIp.id, session=session,
fixed_ips = model_query(context, models.FixedIp, session=session,
read_deleted="yes").\
filter(models.FixedIp.updated_at < time).\
filter(models.FixedIp.instance_id != None).\
filter(models.FixedIp.allocated == False).\
filter(host_filter).\
all()
fixed_ip_ids = [fip.id for fip in fixed_ips]
result = model_query(context, models.FixedIp, session=session,
read_deleted="yes").\
filter(models.FixedIp.id.in_(fixed_ips)).\
filter(models.FixedIp.id.in_(fixed_ip_ids)).\
update({'instance_id': None,
'leased': False,
'updated_at': utils.utcnow()},
Expand Down

0 comments on commit f48f1bb

Please sign in to comment.