Skip to content

Commit

Permalink
Merge pull request #256 from CloudVE/almahmoud-patch-2
Browse files Browse the repository at this point in the history
OS floating IP fix
  • Loading branch information
afgane committed Nov 24, 2020
2 parents 0e4742a + daef1e9 commit 9fdc473
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cloudbridge/providers/openstack/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def create_image(self, label):

def _get_fip(self, floating_ip):
"""Get a floating IP object based on the supplied ID."""
return self._provider.networking._floating_ips.get(floating_ip)
return self._provider.networking._floating_ips.get(None, floating_ip)

def add_floating_ip(self, floating_ip):
"""
Expand Down
19 changes: 19 additions & 0 deletions tests/test_compute_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,3 +395,22 @@ def cleanup_router(router, gateway):
self.assertNotIn(
fip.public_ip,
test_inst.public_ips + test_inst.private_ips)

with cb_helpers.cleanup_action(
lambda: test_inst.remove_floating_ip(fip.id)):
test_inst.add_floating_ip(fip.id)
test_inst.refresh()
# On Devstack, FloatingIP is listed under private_ips.
self.assertIn(fip.public_ip, test_inst.public_ips +
test_inst.private_ips)
fip.refresh()
self.assertTrue(
fip.in_use,
"Attached floating IP %s address should be in use."
% fip.public_ip)
test_inst.refresh()
test_inst.reboot()
test_inst.wait_till_ready()
self.assertNotIn(
fip.public_ip,
test_inst.public_ips + test_inst.private_ips)

0 comments on commit 9fdc473

Please sign in to comment.