changes ovs agent_id init to use hostname instead of mac

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
This commit is contained in:
Sean Mooney 2014-06-10 11:41:49 +01:00
parent 7f79db1d26
commit 744c1bd2f1
2 changed files with 7 additions and 9 deletions

View 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)

View 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