Merge "Make refresh_instance_security_rules() handle non-object instances"

This commit is contained in:
Jenkins 2015-03-24 00:54:37 +00:00 committed by Gerrit Code Review
commit 6cb4c2361a
2 changed files with 9 additions and 0 deletions

View File

@ -1288,6 +1288,7 @@ class ComputeManager(manager.Manager):
"""
return self.driver.refresh_security_group_members(security_group_id)
@object_compat
@wrap_exception()
def refresh_instance_security_rules(self, context, instance):
"""Tell the virtualization driver to refresh security rules for

View File

@ -2402,6 +2402,14 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
self.assertFalse(mock_delete.called)
self.assertFalse(mock_sync.called)
def test_refresh_instance_security_rules_takes_non_object(self):
inst = fake_instance.fake_db_instance()
with mock.patch.object(self.compute.driver,
'refresh_instance_security_rules') as mock_r:
self.compute.refresh_instance_security_rules(self.context, inst)
self.assertIsInstance(mock_r.call_args_list[0][0][0],
objects.Instance)
class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
def setUp(self):