Skip ovsdb_monitor events for ports with ofport=-1
There is no need to trigger neutron-openvswitch-agent to start processing ports in case if invalid port (with ofport=-1) will be added to bridge. Such port will be processed later when ofport will be changed. Change-Id: I3465daf4809d5d56565f59b177b5f8870352cc9d Related-Bug: #1808171 Related-Bug: #1811405
This commit is contained in:
parent
284afcf24f
commit
f8e0a497ad
@ -16,6 +16,7 @@ from oslo_log import log as logging
|
|||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from neutron.agent.common import async_process
|
from neutron.agent.common import async_process
|
||||||
|
from neutron.agent.common import ovs_lib
|
||||||
from neutron.agent.ovsdb import api as ovsdb
|
from neutron.agent.ovsdb import api as ovsdb
|
||||||
from neutron.agent.ovsdb.native import helpers
|
from neutron.agent.ovsdb.native import helpers
|
||||||
from neutron.common import utils
|
from neutron.common import utils
|
||||||
@ -108,6 +109,11 @@ class SimpleInterfaceMonitor(OvsdbMonitor):
|
|||||||
external_ids = ovsdb.val_to_py(external_ids)
|
external_ids = ovsdb.val_to_py(external_ids)
|
||||||
if ofport:
|
if ofport:
|
||||||
ofport = ovsdb.val_to_py(ofport)
|
ofport = ovsdb.val_to_py(ofport)
|
||||||
|
if ofport == ovs_lib.INVALID_OFPORT:
|
||||||
|
LOG.debug("Ofport of port %(name)s is %(ofport)s. "
|
||||||
|
"Skipping its event.",
|
||||||
|
{'name': name, 'ofport': ofport})
|
||||||
|
continue
|
||||||
device = {'name': name,
|
device = {'name': name,
|
||||||
'ofport': ofport,
|
'ofport': ofport,
|
||||||
'external_ids': external_ids}
|
'external_ids': external_ids}
|
||||||
|
@ -85,3 +85,12 @@ class TestSimpleInterfaceMonitor(base.BaseTestCase):
|
|||||||
self.monitor.process_events()
|
self.monitor.process_events()
|
||||||
self.assertEqual(self.monitor.new_events['added'][0]['ofport'],
|
self.assertEqual(self.monitor.new_events['added'][0]['ofport'],
|
||||||
ovs_lib.UNASSIGNED_OFPORT)
|
ovs_lib.UNASSIGNED_OFPORT)
|
||||||
|
|
||||||
|
def process_event_invalid_of_port(self):
|
||||||
|
output = '{"data":[["e040fbec-0579-4990-8324-d338da33ae88","insert",'
|
||||||
|
output += '"m50",-1,["map",[]]]],"headings":["row","action",'
|
||||||
|
output += '"name","ofport","external_ids"]}'
|
||||||
|
with mock.patch.object(
|
||||||
|
self.monitor, 'iter_stdout', return_value=[output]):
|
||||||
|
self.monitor.process_events()
|
||||||
|
self.assertEqual([], self.monitor.new_events['added'])
|
||||||
|
Loading…
Reference in New Issue
Block a user