From 8279240ee30d55d127e4d964a9861b721ac7cc74 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 20 Jan 2012 16:39:41 -0600 Subject: Handle error in associate floating IP (bug 845507) * Raise NoFloatingIpInterface when associate floating IP has an interface that doesn't exist. * Return 500 Internal server Error, indicate only that associate action failed Change-Id: I6b032f7554795de64bce8e669d20269210c62e33 --- nova/tests/test_network.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/test_network.py b/nova/tests/test_network.py index 573a308e1..200251b7e 100644 --- a/nova/tests/test_network.py +++ b/nova/tests/test_network.py @@ -636,6 +636,23 @@ class VlanNetworkTestCase(test.TestCase): def fake7(*args, **kwargs): self.local = True + def fake8(*args, **kwargs): + raise exception.ProcessExecutionError('', + 'Cannot find device "em0"\n') + + # raises because interface doesn't exist + self.stubs.Set(self.network.db, + 'floating_ip_fixed_ip_associate', + fake1) + self.stubs.Set(self.network.db, 'floating_ip_disassociate', fake1) + self.stubs.Set(self.network.driver, 'bind_floating_ip', fake8) + self.assertRaises(exception.NoFloatingIpInterface, + self.network._associate_floating_ip, + ctxt, + mox.IgnoreArg(), + mox.IgnoreArg(), + mox.IgnoreArg()) + self.stubs.Set(self.network, '_floating_ip_owned_by_project', fake1) # raises because floating_ip is already associated to a fixed_ip -- cgit