]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
changes ovs agent_id init to use hostname instead of mac
authorSean Mooney <sean.k.mooney@intel.com>
Tue, 10 Jun 2014 10:41:49 +0000 (11:41 +0100)
committerSean Mooney <sean.k.mooney@intel.com>
Tue, 10 Jun 2014 10:41:49 +0000 (11:41 +0100)
In the Open vSwitch agent,
the Agent id is currently based off the mac address of the br-int.
Userspace only Open vSwitch derivatives such as Intel's DPDK
Accelerated Open vSwitch do not currently create a tap device in the kernel
to back the ovs bridges local port.
This limitation prevents reuse of the OpenVSwitch agent between both switches.

To enable reuse of the ovs agent with Intel's DPDK Accelerated Open vSwitch,
the proposal is to change the  generation of the  agent_id to use the hostname,
instead of the mac address of the br-int.

For several plugins such as the nec,mlnx,hyperv and onconvergence agents
the hostname is used to create the agent id.
Using the hostname will normalise the agent_id between these 5 neutron agents,
additionally log readability will also be improved,
if log aggregation is preformed across a cluster
as it will be easier to identify which node the log is from.

the hostname is retrived from cfg.CONF.host

Closes-Bug: #1323259
Change-Id: I9abfac17a74d298f1a17a0931fc98ac00234ac0b

neutron/plugins/openvswitch/agent/ovs_neutron_agent.py
neutron/tests/unit/openvswitch/test_ovs_tunnel.py

index f4a46c24275560af186f68e77e17562aa10d2b74..b706e4173751d52c1645d893d9253a07304e7057 100644 (file)
@@ -236,8 +236,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
             LOG.exception(_("Failed reporting state!"))
 
     def setup_rpc(self):
-        mac = self.int_br.get_local_port_mac()
-        self.agent_id = '%s%s' % ('ovs', (mac.replace(":", "")))
+        self.agent_id = 'ovs-agent-%s' % cfg.CONF.host
         self.topic = topics.AGENT
         self.plugin_rpc = OVSPluginApi(topics.PLUGIN)
         self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
index cb4c7cd98132c223ea2a82a6341a8a6d104782bf..7835dda8fbc404ffa9ca3119faab305627f4a942 100644 (file)
@@ -105,10 +105,8 @@ class TunnelTest(base.BaseTestCase):
         ]
 
         self.mock_int_bridge = self.ovs_bridges[self.INT_BRIDGE]
-        self.mock_int_bridge.get_local_port_mac.return_value = '000000000001'
         self.mock_int_bridge_expected = [
             mock.call.set_secure_mode(),
-            mock.call.get_local_port_mac(),
             mock.call.delete_port('patch-tun'),
             mock.call.remove_all_flows(),
             mock.call.add_flow(priority=1, actions='normal'),
@@ -249,11 +247,12 @@ class TunnelTest(base.BaseTestCase):
         self._verify_mock_call(self.execute, self.execute_expected)
 
     def test_construct(self):
-        ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
-                                          self.TUN_BRIDGE,
-                                          '10.0.0.1', self.NET_MAPPING,
-                                          'sudo', 2, ['gre'],
-                                          self.VETH_MTU)
+        agent = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
+                                                  self.TUN_BRIDGE,
+                                                  '10.0.0.1', self.NET_MAPPING,
+                                                  'sudo', 2, ['gre'],
+                                                  self.VETH_MTU)
+        self.assertEqual(agent.agent_id, 'ovs-agent-%s' % cfg.CONF.host)
         self._verify_mock_calls()
 
     # TODO(ethuleau): Initially, local ARP responder is be dependent to the