Merge "Handle error in associate floating IP (bug 845507)"
This commit is contained in:
@@ -588,6 +588,10 @@ class NoFloatingIpsDefined(NotFound):
|
|||||||
message = _("Zero floating ips exist.")
|
message = _("Zero floating ips exist.")
|
||||||
|
|
||||||
|
|
||||||
|
class NoFloatingIpInterface(NotFound):
|
||||||
|
message = _("Interface %(interface)s not found.")
|
||||||
|
|
||||||
|
|
||||||
class KeypairNotFound(NotFound):
|
class KeypairNotFound(NotFound):
|
||||||
message = _("Keypair %(name)s not found for user %(user_id)s")
|
message = _("Keypair %(name)s not found for user %(user_id)s")
|
||||||
|
|
||||||
|
@@ -636,6 +636,23 @@ class VlanNetworkTestCase(test.TestCase):
|
|||||||
def fake7(*args, **kwargs):
|
def fake7(*args, **kwargs):
|
||||||
self.local = True
|
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)
|
self.stubs.Set(self.network, '_floating_ip_owned_by_project', fake1)
|
||||||
|
|
||||||
# raises because floating_ip is already associated to a fixed_ip
|
# raises because floating_ip is already associated to a fixed_ip
|
||||||
|
Reference in New Issue
Block a user