diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py index ec805bf0bdc..c2b823d94dd 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_config import cfg from oslo_log import log as logging import oslo_messaging from oslo_utils import excutils @@ -25,6 +26,9 @@ from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants LOG = logging.getLogger(__name__) +cfg.CONF.import_group('AGENT', 'neutron.plugins.ml2.drivers.openvswitch.' + 'agent.common.config') + # A class to represent a DVR-hosted subnet including vif_ports resident on # that subnet @@ -134,6 +138,7 @@ class OVSDVRNeutronAgent(object): self.dvr_mac_address = None if self.enable_distributed_routing: self.get_dvr_mac_address() + self.conf = cfg.CONF def setup_dvr_flows(self): self.setup_dvr_flows_on_integ_br() @@ -205,7 +210,8 @@ class OVSDVRNeutronAgent(object): LOG.info(_LI("L2 Agent operating in DVR Mode with MAC %s"), self.dvr_mac_address) # Remove existing flows in integration bridge - self.int_br.delete_flows() + if self.conf.AGENT.drop_flows_on_start: + self.int_br.delete_flows() # Add a canary flow to int_br to track OVS restarts self.int_br.setup_canary_table() diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py index f4b422879a9..0af60b24237 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py @@ -2169,7 +2169,6 @@ class TestOvsDvrNeutronAgent(object): ioport = self.agent.dvr_agent.int_ofports[physical_networks[0]] expected_on_int_br = [ # setup_dvr_flows_on_integ_br - mock.call.delete_flows(), mock.call.setup_canary_table(), mock.call.install_drop(table_id=constants.DVR_TO_SRC_MAC, priority=1),