]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Graceful OVS restart for DVR
authorAnn Kamyshnikova <akamyshnikova@mirantis.com>
Fri, 21 Aug 2015 12:13:25 +0000 (15:13 +0300)
committerAnn Kamyshnikova <akamyshnikova@mirantis.com>
Fri, 21 Aug 2015 12:16:30 +0000 (15:16 +0300)
Graceful OVS restart that was intoduced in I95070d8218859d4fff1d572c1792cdf6019dd7ea
missed that flows are also dropped in setup_dvr_flows_on_integ_br.

Related-bug: #1383674

Change-Id: I7b24a159962af7b58c096a1b2766e2169e9f8aed

neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py
neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py

index ec805bf0bdc6fd9b03d45c72d256954ccee5ebbd..c2b823d94dd4594e683d514d44ebd7731db4a484 100644 (file)
@@ -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()
index 07c02f36251a08de2ffca8092d0777e3da255d0a..81c42c61964a20803717fbadb1f217672c65a30e 100644 (file)
@@ -2129,7 +2129,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),