Merge lp:~vishvananda/nova/fix-floating-reboot into lp:~hudson-openstack/nova/milestone-proposed

Proposed by Vish Ishaya
Status: Merged
Approved by: Vish Ishaya
Approved revision: 1542
Merged at revision: 1168
Proposed branch: lp:~vishvananda/nova/fix-floating-reboot
Merge into: lp:~hudson-openstack/nova/milestone-proposed
Diff against target: 97 lines (+14/-6)
4 files modified
nova/db/api.py (+5/-3)
nova/db/sqlalchemy/api.py (+4/-1)
nova/network/manager.py (+2/-1)
nova/tests/db/fakes.py (+3/-1)
To merge this branch: bzr merge lp:~vishvananda/nova/fix-floating-reboot
Reviewer Review Type Date Requested Status
OpenStack release team Pending
Review via email: mp+75434@code.launchpad.net

Description of the change

Fix issue where floating ips don't get recreated when a network host reboots.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/db/api.py'
2--- nova/db/api.py 2011-09-08 20:49:03 +0000
3+++ nova/db/api.py 2011-09-14 21:44:03 +0000
4@@ -261,11 +261,13 @@
5 return IMPL.floating_ip_disassociate(context, address)
6
7
8-def floating_ip_fixed_ip_associate(context, floating_address, fixed_address):
9+def floating_ip_fixed_ip_associate(context, floating_address,
10+ fixed_address, host):
11 """Associate an floating ip to a fixed_ip by address."""
12 return IMPL.floating_ip_fixed_ip_associate(context,
13 floating_address,
14- fixed_address)
15+ fixed_address,
16+ host)
17
18
19 def floating_ip_get_all(context):
20@@ -367,7 +369,7 @@
21
22 def fixed_ip_get_all_by_instance_host(context, host):
23 """Get all allocated fixed ips filtered by instance host."""
24- return IMPL.fixed_ip_get_all_instance_by_host(context, host)
25+ return IMPL.fixed_ip_get_all_by_instance_host(context, host)
26
27
28 def fixed_ip_get_by_address(context, address):
29
30=== modified file 'nova/db/sqlalchemy/api.py'
31--- nova/db/sqlalchemy/api.py 2011-09-12 06:12:15 +0000
32+++ nova/db/sqlalchemy/api.py 2011-09-14 21:44:03 +0000
33@@ -529,7 +529,8 @@
34
35
36 @require_context
37-def floating_ip_fixed_ip_associate(context, floating_address, fixed_address):
38+def floating_ip_fixed_ip_associate(context, floating_address,
39+ fixed_address, host):
40 session = get_session()
41 with session.begin():
42 # TODO(devcamcar): How to ensure floating_id belongs to user?
43@@ -540,6 +541,7 @@
44 fixed_address,
45 session=session)
46 floating_ip_ref.fixed_ip = fixed_ip_ref
47+ floating_ip_ref.host = host
48 floating_ip_ref.save(session=session)
49
50
51@@ -583,6 +585,7 @@
52 else:
53 fixed_ip_address = None
54 floating_ip_ref.fixed_ip = None
55+ floating_ip_ref.host = None
56 floating_ip_ref.save(session=session)
57 return fixed_ip_address
58
59
60=== modified file 'nova/network/manager.py'
61--- nova/network/manager.py 2011-09-12 06:12:15 +0000
62+++ nova/network/manager.py 2011-09-14 21:44:03 +0000
63@@ -289,7 +289,8 @@
64
65 self.db.floating_ip_fixed_ip_associate(context,
66 floating_address,
67- fixed_address)
68+ fixed_address,
69+ self.host)
70 self.driver.bind_floating_ip(floating_address)
71 self.driver.ensure_floating_forward(floating_address, fixed_address)
72
73
74=== modified file 'nova/tests/db/fakes.py'
75--- nova/tests/db/fakes.py 2011-07-19 21:25:16 +0000
76+++ nova/tests/db/fakes.py 2011-09-14 21:44:03 +0000
77@@ -125,10 +125,11 @@
78 if ips[0]['fixed_ip']:
79 fixed_ip_address = ips[0]['fixed_ip']['address']
80 ips[0]['fixed_ip'] = None
81+ ips[0]['host'] = None
82 return fixed_ip_address
83
84 def fake_floating_ip_fixed_ip_associate(context, floating_address,
85- fixed_address):
86+ fixed_address, host):
87 float = filter(lambda i: i['address'] == floating_address,
88 floating_ips)
89 fixed = filter(lambda i: i['address'] == fixed_address,
90@@ -136,6 +137,7 @@
91 if float and fixed:
92 float[0]['fixed_ip'] = fixed[0]
93 float[0]['fixed_ip_id'] = fixed[0]['id']
94+ float[0]['host'] = host
95
96 def fake_floating_ip_get_all_by_host(context, host):
97 # TODO(jkoelker): Once we get the patches that remove host from

Subscribers

People subscribed via source and target branches