From e12339def3d9182f5ab23869e6bdc946e8e42825 Mon Sep 17 00:00:00 2001 From: Chet Burgess Date: Thu, 24 Jan 2013 03:18:40 +0000 Subject: populate dnsmasq lease db with valid leases At start dnsmasq retrieves its lease db by calling the nova-dhcpbridge script with the init action. Previously we were returning all allocated IPs in the network and calculating the lease exirpation time based upon instances.updated_at or instances.created_at. Now we are only returning entries for IPs that are allocated and leased. Additionally we set the lease expiration time to be i now + CONF.dhcp_lease_time Change-Id: Ie3b4fafd38094dc01ceea592ab5229e581193512 Fixes: bug #1103260 --- nova/db/sqlalchemy/api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'nova/db') diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index dff2e6b81..03d5056cb 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -2245,7 +2245,9 @@ def network_get_associated_fixed_ips(context, network_id, host=None): models.VirtualInterface.address, models.Instance.hostname, models.Instance.updated_at, - models.Instance.created_at).\ + models.Instance.created_at, + models.FixedIp.allocated, + models.FixedIp.leased).\ filter(models.FixedIp.deleted == 0).\ filter(models.FixedIp.network_id == network_id).\ filter(models.FixedIp.allocated == True).\ @@ -2267,6 +2269,8 @@ def network_get_associated_fixed_ips(context, network_id, host=None): cleaned['instance_hostname'] = datum[5] cleaned['instance_updated'] = datum[6] cleaned['instance_created'] = datum[7] + cleaned['allocated'] = datum[8] + cleaned['leased'] = datum[9] data.append(cleaned) return data -- cgit