]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Hyper-V: Fixes security groups issue
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Tue, 27 Jan 2015 13:23:27 +0000 (15:23 +0200)
committerVivekanandan Narasimhan <vivekanandan.narasimhan@hp.com>
Tue, 17 Feb 2015 12:29:50 +0000 (12:29 +0000)
After this patch If19be8579ca734a899cdd673c919eee8165aaa0e refactored
securitygroups_rpc, prepare_devices_filter attempts to use methods
unimplemented by the HyperV security groups driver.

For this reason, binding ports fails with NotImplementedError if
security groups are enabled.

Until the HyperV security groups driver reaches parity, the
use_enhanced_rpc property should be set to False on the
HyperVSecurityAgent, falling back to the old behaviour.

Change-Id: I1a7ee2b92367d2d59932b8b39372a055bf19951b
Closes-Bug: #1415523

neutron/plugins/hyperv/agent/hyperv_neutron_agent.py
neutron/tests/unit/hyperv/test_hyperv_neutron_agent.py

index 3dc69200de8a4e47a89d97f9593bdb385f1980d8..3752956290e2e0689d3d51738c3ec122352eb30c 100644 (file)
@@ -88,6 +88,10 @@ class HyperVSecurityAgent(sg_rpc.SecurityGroupAgentRpc):
         if sg_rpc.is_firewall_enabled():
             self._setup_rpc()
 
+    @property
+    def use_enhanced_rpc(self):
+        return False
+
     def _setup_rpc(self):
         self.topic = topics.AGENT
         self.endpoints = [HyperVSecurityCallbackMixin(self)]
index 12a5d83771870f0df4c190bd42e8a1b56afabdab..16b61e7a6110e8b1f762d7de846bbd9a6d7b8097 100644 (file)
@@ -56,6 +56,7 @@ class TestHyperVNeutronAgent(base.BaseTestCase):
         self.agent = hyperv_neutron_agent.HyperVNeutronAgent()
         self.agent.plugin_rpc = mock.Mock()
         self.agent.sec_groups_agent = mock.MagicMock()
+        self.agent.sg_plugin_rpc = mock.Mock()
         self.agent.context = mock.Mock()
         self.agent.agent_id = mock.Mock()
 
@@ -68,6 +69,11 @@ class TestHyperVNeutronAgent(base.BaseTestCase):
             'start_flag': True}
         self.agent_state = fake_agent_state
 
+    def test_use_enhanced_rpc(self):
+        self.agent.sec_groups_agent = hyperv_neutron_agent.HyperVSecurityAgent(
+            self.agent.context, self.agent.sg_plugin_rpc)
+        self.assertFalse(self.agent.sec_groups_agent.use_enhanced_rpc)
+
     def test_port_bound_enable_metrics(self):
         cfg.CONF.set_override('enable_metrics_collection', True, 'AGENT')
         self._test_port_bound(True)