Change OVS agent to update skipped port status to DOWN
When the OVS agent skips processing a port because it was not found on the integration bridge, it doesn't send back any status to the server to notify it. This can cause the port to get stuck in the BUILD state indefinitely, since that is the default state it gets before the server tells the agent to update it. The OVS agent will now notify the server that any skipped device should be considered DOWN if it did not exist. Change-Id: I15dc55951cdb75c6d87d7c645f8e2cbf82b2f3e4 Closes-bug: #1719011
This commit is contained in:
parent
fc73306daa
commit
a789d23b02
|
@ -1627,6 +1627,17 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
|
||||||
LOG.debug("Device %s not defined on plugin", detail['device'])
|
LOG.debug("Device %s not defined on plugin", detail['device'])
|
||||||
return failed_devices
|
return failed_devices
|
||||||
|
|
||||||
|
def treat_devices_skipped(self, devices):
|
||||||
|
LOG.info("Ports %s skipped, changing status to down", devices)
|
||||||
|
devices_down = self.plugin_rpc.update_device_list(self.context,
|
||||||
|
[],
|
||||||
|
devices,
|
||||||
|
self.agent_id,
|
||||||
|
self.conf.host)
|
||||||
|
failed_devices = set(devices_down.get('failed_devices_down'))
|
||||||
|
if failed_devices:
|
||||||
|
LOG.debug("Port down failed for %s", failed_devices)
|
||||||
|
|
||||||
def process_network_ports(self, port_info, ovs_restarted):
|
def process_network_ports(self, port_info, ovs_restarted):
|
||||||
failed_devices = {'added': set(), 'removed': set()}
|
failed_devices = {'added': set(), 'removed': set()}
|
||||||
# TODO(salv-orlando): consider a solution for ensuring notifications
|
# TODO(salv-orlando): consider a solution for ensuring notifications
|
||||||
|
@ -1680,6 +1691,13 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
|
||||||
"treat_devices_removed completed in %(elapsed).3f",
|
"treat_devices_removed completed in %(elapsed).3f",
|
||||||
{'iter_num': self.iter_num,
|
{'iter_num': self.iter_num,
|
||||||
'elapsed': time.time() - start})
|
'elapsed': time.time() - start})
|
||||||
|
if skipped_devices:
|
||||||
|
start = time.time()
|
||||||
|
self.treat_devices_skipped(skipped_devices)
|
||||||
|
LOG.debug("process_network_ports - iteration:%(iter_num)d - "
|
||||||
|
"treat_devices_skipped completed in %(elapsed).3f",
|
||||||
|
{'iter_num': self.iter_num,
|
||||||
|
'elapsed': time.time() - start})
|
||||||
return failed_devices
|
return failed_devices
|
||||||
|
|
||||||
def process_ancillary_network_ports(self, port_info):
|
def process_ancillary_network_ports(self, port_info):
|
||||||
|
|
|
@ -989,7 +989,11 @@ class TestOvsNeutronAgent(object):
|
||||||
"treat_devices_removed",
|
"treat_devices_removed",
|
||||||
return_value=(
|
return_value=(
|
||||||
failed_devices[
|
failed_devices[
|
||||||
'removed'])) as device_removed:
|
'removed'])) as device_removed,\
|
||||||
|
mock.patch.object(self.agent,
|
||||||
|
"treat_devices_skipped",
|
||||||
|
return_value=(
|
||||||
|
skipped_devices)) as device_skipped:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
failed_devices,
|
failed_devices,
|
||||||
self.agent.process_network_ports(port_info, False))
|
self.agent.process_network_ports(port_info, False))
|
||||||
|
@ -1003,6 +1007,8 @@ class TestOvsNeutronAgent(object):
|
||||||
devices_added_updated, False)
|
devices_added_updated, False)
|
||||||
if port_info.get('removed', set()):
|
if port_info.get('removed', set()):
|
||||||
device_removed.assert_called_once_with(port_info['removed'])
|
device_removed.assert_called_once_with(port_info['removed'])
|
||||||
|
if skipped_devices:
|
||||||
|
device_skipped.assert_called_once_with(set(skipped_devices))
|
||||||
|
|
||||||
def test_process_network_ports(self):
|
def test_process_network_ports(self):
|
||||||
self._test_process_network_ports(
|
self._test_process_network_ports(
|
||||||
|
|
Loading…
Reference in New Issue