Merge "Change OVS agent to update skipped port status to DOWN"
This commit is contained in:
commit
5fc8e47786
|
@ -1620,6 +1620,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
|
||||||
|
@ -1673,6 +1684,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):
|
||||||
|
|
|
@ -991,7 +991,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))
|
||||||
|
@ -1005,6 +1009,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