diff options
| author | Michael Still <mikal@stillhq.com> | 2012-10-11 15:46:11 +1100 |
|---|---|---|
| committer | Michael Still <mikal@stillhq.com> | 2012-10-11 15:51:28 +1100 |
| commit | ba585524e32965697c1a44c8fd743dea060bb1af (patch) | |
| tree | 68c8151a87e551384403f5ba6bc9cc7b660fc34b /nova/tests | |
| parent | f54cf7bf53a07be8bcea817fd53359d02c3eda7c (diff) | |
Avoid RPC calls while holding iptables lock.
This exhibitied itself as very slow instance starts on a Canonical
test cluster. This was because do_referesh_security_group_rules()
was making rpc calls while holding the iptables lock. This refactor
avoids that while making no functional changes (I hope).
This should resolve bug 1062314.
Change-Id: I36f805bd72f7bd06082cfe96c58d637203bcffb7
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_libvirt.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index 8861eb8de..7af877f22 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -3142,11 +3142,23 @@ class IptablesFirewallTestCase(test.TestCase): def test_do_refresh_security_group_rules(self): instance_ref = self._create_instance_ref() self.mox.StubOutWithMock(self.fw, + 'instance_rules') + self.mox.StubOutWithMock(self.fw, 'add_filters_for_instance', use_mock_anything=True) + + self.fw.instance_rules(instance_ref, + mox.IgnoreArg()).AndReturn((None, None)) + self.fw.add_filters_for_instance(instance_ref, mox.IgnoreArg(), + mox.IgnoreArg()) + self.fw.instance_rules(instance_ref, + mox.IgnoreArg()).AndReturn((None, None)) + self.fw.add_filters_for_instance(instance_ref, mox.IgnoreArg(), + mox.IgnoreArg()) + self.mox.ReplayAll() + self.fw.prepare_instance_filter(instance_ref, mox.IgnoreArg()) self.fw.instances[instance_ref['id']] = instance_ref - self.mox.ReplayAll() self.fw.do_refresh_security_group_rules("fake") def test_unfilter_instance_undefines_nwfilter(self): |
