Merge "Ensure floatingip information is retrieved"
This commit is contained in:
commit
3d845cecd0
|
@ -141,11 +141,13 @@ class FipPubIpDriver(BasePubIpDriver):
|
||||||
except n_exc.Conflict:
|
except n_exc.Conflict:
|
||||||
LOG.warning("Conflict when assigning floating IP with id %s. "
|
LOG.warning("Conflict when assigning floating IP with id %s. "
|
||||||
"Checking if it's already assigned correctly.", res_id)
|
"Checking if it's already assigned correctly.", res_id)
|
||||||
fip = neutron.show_floatingip(res_id)
|
fip = neutron.show_floatingip(res_id).get('floatingip')
|
||||||
used_port_id = fip['port_id']
|
if fip is not None and fip.get('port_id') == vip_port_id:
|
||||||
if used_port_id != vip_port_id:
|
LOG.debug('FIP %s already assigned to %s', res_id,
|
||||||
LOG.exception("Floating IP already used by port %s.",
|
vip_port_id)
|
||||||
used_port_id)
|
else:
|
||||||
|
LOG.exception('Failed to assign FIP %s to VIP port %s. It is '
|
||||||
|
'probably already bound', res_id, vip_port_id)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
except n_exc.NeutronClientException:
|
except n_exc.NeutronClientException:
|
||||||
|
|
|
@ -128,8 +128,10 @@ class TestFipPubIpDriver(test_base.TestCase):
|
||||||
|
|
||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
neutron.update_floatingip.side_effect = n_exc.Conflict
|
neutron.update_floatingip.side_effect = n_exc.Conflict
|
||||||
neutron.show_floatingip.return_value = {'id': res_id,
|
neutron.show_floatingip.return_value = {
|
||||||
'port_id': vip_port_id}
|
'floatingip': {
|
||||||
|
'id': res_id,
|
||||||
|
'port_id': vip_port_id}}
|
||||||
self.assertIsNone(driver.associate(res_id, vip_port_id))
|
self.assertIsNone(driver.associate(res_id, vip_port_id))
|
||||||
|
|
||||||
def test_associate_conflict_incorrect(self):
|
def test_associate_conflict_incorrect(self):
|
||||||
|
@ -139,7 +141,10 @@ class TestFipPubIpDriver(test_base.TestCase):
|
||||||
|
|
||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
neutron.update_floatingip.side_effect = n_exc.Conflict
|
neutron.update_floatingip.side_effect = n_exc.Conflict
|
||||||
neutron.show_floatingip.return_value = {'id': res_id, 'port_id': 'foo'}
|
neutron.show_floatingip.return_value = {
|
||||||
|
'floatingip': {
|
||||||
|
'id': res_id,
|
||||||
|
'port_id': 'foo'}}
|
||||||
self.assertRaises(n_exc.Conflict, driver.associate, res_id,
|
self.assertRaises(n_exc.Conflict, driver.associate, res_id,
|
||||||
vip_port_id)
|
vip_port_id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue