Update dhcp host portbinding on failover

When a dhcp server is moved to new host on failover,
tunnel is not created.

When a dhcp server is moved to new host,
1) network-hostagent binding is updated(properly i.e with new host).
2) dhcp port-hostagent binding is not updated
   ( dhcp port is still bound to old host)
If dhcp port-bound agent is different from the new dhcp agent
(which is now taking care of this dhcp port), neutron plugin won't
 notify the l2pop, and hence tunnel is not created.

As after failover, the new agent is taking care of this dhcp port,
update portbinding with the new host. This will allow neutron plugin
to notify l2pop(which will create tunnel).

Change-Id: Ib7d7dcddee005395af116ccd31a43853332ae317
Closes-bug: #1411163
(cherry picked from commit 571453c614)
This commit is contained in:
venkata anil 2015-07-02 11:22:39 +00:00
parent d9398261ce
commit 9950ce2bbc
2 changed files with 3 additions and 0 deletions

View File

@ -308,5 +308,6 @@ class DhcpRpcCallback(object):
'from %(host)s.', 'from %(host)s.',
{'port': port, {'port': port,
'host': host}) 'host': host})
port['port'][portbindings.HOST_ID] = host
plugin = manager.NeutronManager.get_plugin() plugin = manager.NeutronManager.get_plugin()
return self._port_action(plugin, context, port, 'update_port') return self._port_action(plugin, context, port, 'update_port')

View File

@ -190,6 +190,7 @@ class TestDhcpRpcCallback(base.BaseTestCase):
} }
expected_port = {'port': {'network_id': 'foo_network_id', expected_port = {'port': {'network_id': 'foo_network_id',
'device_owner': constants.DEVICE_OWNER_DHCP, 'device_owner': constants.DEVICE_OWNER_DHCP,
'binding:host_id': 'foo_host',
'fixed_ips': [{'subnet_id': 'foo_subnet_id'}] 'fixed_ips': [{'subnet_id': 'foo_subnet_id'}]
}, },
'id': 'foo_port_id' 'id': 'foo_port_id'
@ -211,6 +212,7 @@ class TestDhcpRpcCallback(base.BaseTestCase):
} }
expected_port = {'port': {'network_id': 'foo_network_id', expected_port = {'port': {'network_id': 'foo_network_id',
'device_owner': constants.DEVICE_OWNER_DHCP, 'device_owner': constants.DEVICE_OWNER_DHCP,
'binding:host_id': 'foo_host',
'fixed_ips': [{'subnet_id': 'foo_subnet_id'}] 'fixed_ips': [{'subnet_id': 'foo_subnet_id'}]
}, },
'id': 'foo_port_id' 'id': 'foo_port_id'