]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Update dhcp host portbinding on failover
authorvenkata anil <anil.venkata@enovance.com>
Thu, 2 Jul 2015 11:22:39 +0000 (11:22 +0000)
committervenkata anil <anil.venkata@enovance.com>
Thu, 2 Jul 2015 12:46:50 +0000 (12:46 +0000)
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

neutron/api/rpc/handlers/dhcp_rpc.py
neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py

index 7d97b7c52269671bc4200b51594ab209eb95e51a..80d8a01776b4b1f79c1b22de685acc4c5b870c5b 100644 (file)
@@ -232,5 +232,6 @@ class DhcpRpcCallback(object):
                   'from %(host)s.',
                   {'port': port,
                    'host': host})
+        port['port'][portbindings.HOST_ID] = host
         plugin = manager.NeutronManager.get_plugin()
         return self._port_action(plugin, context, port, 'update_port')
index c17c57e27aa0de172603b56aa744b2ca26dce282..00dafcf99cf8a994c0794c29b7df42a93adf5828 100644 (file)
@@ -159,6 +159,7 @@ class TestDhcpRpcCallback(base.BaseTestCase):
                 }
         expected_port = {'port': {'network_id': 'foo_network_id',
                                   'device_owner': constants.DEVICE_OWNER_DHCP,
+                                  'binding:host_id': 'foo_host',
                                   'fixed_ips': [{'subnet_id': 'foo_subnet_id'}]
                                   },
                          'id': 'foo_port_id'
@@ -180,6 +181,7 @@ class TestDhcpRpcCallback(base.BaseTestCase):
                 }
         expected_port = {'port': {'network_id': 'foo_network_id',
                                   'device_owner': constants.DEVICE_OWNER_DHCP,
+                                  'binding:host_id': 'foo_host',
                                   'fixed_ips': [{'subnet_id': 'foo_subnet_id'}]
                                   },
                          'id': 'foo_port_id'