diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2012-03-31 14:48:30 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2012-03-31 14:51:07 -0700 |
| commit | d0aa02485614ba8e6258c6743d03e83bc8983f2f (patch) | |
| tree | ca30652bcbb1342035205849bd37e637c7a8705c /nova/tests | |
| parent | 37dad352a17203102b4b9b828f84db9b75c57071 (diff) | |
Ensure floating ips are recreated on reboot
* includes failing test
* fixes bug 970041
Change-Id: Ifee5b95b86278dcf2320460cf700293fd3a21153
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/network/test_manager.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py index a6f653961..ef1e6b70c 100644 --- a/nova/tests/network/test_manager.py +++ b/nova/tests/network/test_manager.py @@ -692,6 +692,33 @@ class VlanNetworkTestCase(test.TestCase): mox.IgnoreArg()) self.assertTrue(self.local) + def test_floating_ip_init_host(self): + + def get_all_by_host(_context, _host): + return [{'interface': 'foo', + 'address': 'foo'}, + {'interface': 'fakeiface', + 'address': 'fakefloat', + 'fixed_ip_id': 1}, + {'interface': 'bar', + 'address': 'bar', + 'fixed_ip_id': 2}] + self.stubs.Set(self.network.db, 'floating_ip_get_all_by_host', + get_all_by_host) + + def fixed_ip_get(_context, fixed_ip_id): + if fixed_ip_id == 1: + return {'address': 'fakefixed'} + raise exception.FixedIpNotFound() + self.stubs.Set(self.network.db, 'fixed_ip_get', fixed_ip_get) + + self.mox.StubOutWithMock(self.network.l3driver, 'add_floating_ip') + self.network.l3driver.add_floating_ip('fakefloat', + 'fakefixed', + 'fakeiface') + self.mox.ReplayAll() + self.network.init_host_floating_ips() + def test_disassociate_floating_ip(self): ctxt = context.RequestContext('testuser', 'testproject', is_admin=False) |
