diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-09-20 07:39:15 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-09-20 07:39:15 +0000 |
commit | 7157085837fd9de27bba5ff8dc575956d26b8a27 (patch) | |
tree | 205362d6f12b3da70bebfc509d6acb3d2e9d6139 | |
parent | 81c226473e30a40f09507be00e702c35e4667df4 (diff) | |
parent | ce354f595b897ac26548c535e6378b9cc9c7b110 (diff) | |
download | nova-7157085837fd9de27bba5ff8dc575956d26b8a27.tar.gz |
Merge "Add declaration of 'refresh_instance_security_rules' to virt driver" into stable/havana
-rw-r--r-- | nova/compute/manager.py | 7 | ||||
-rwxr-xr-x | nova/tests/virt/hyperv/test_hypervapi.py | 5 | ||||
-rwxr-xr-x | nova/tests/virt/vmwareapi/test_vmwareapi.py | 5 | ||||
-rw-r--r-- | nova/virt/driver.py | 9 |
4 files changed, 25 insertions, 1 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index d54e39c025..bcf3063bd0 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -860,7 +860,12 @@ class ComputeManager(manager.SchedulerDependentManager): """ @utils.synchronized(instance['uuid']) def _sync_refresh(): - return self.driver.refresh_instance_security_rules(instance) + try: + return self.driver.refresh_instance_security_rules(instance) + except NotImplementedError: + LOG.warning(_('Hypervisor driver does not support ' + 'security groups.'), instance=instance) + return _sync_refresh() @wrap_exception() diff --git a/nova/tests/virt/hyperv/test_hypervapi.py b/nova/tests/virt/hyperv/test_hypervapi.py index 8171048170..5d75fe5085 100755 --- a/nova/tests/virt/hyperv/test_hypervapi.py +++ b/nova/tests/virt/hyperv/test_hypervapi.py @@ -1630,6 +1630,11 @@ class HyperVAPITestCase(test.NoDBTestCase): def test_finish_revert_migration_with_ephemeral_storage(self): self._test_finish_revert_migration(False, ephemeral_storage=True) + def test_refresh_instance_security_rules(self): + self.assertRaises(NotImplementedError, + self._conn.refresh_instance_security_rules, + instance=None) + class VolumeOpsTestCase(HyperVAPITestCase): """Unit tests for VolumeOps class.""" diff --git a/nova/tests/virt/vmwareapi/test_vmwareapi.py b/nova/tests/virt/vmwareapi/test_vmwareapi.py index cef0d59729..e8e0afefd3 100755 --- a/nova/tests/virt/vmwareapi/test_vmwareapi.py +++ b/nova/tests/virt/vmwareapi/test_vmwareapi.py @@ -1247,6 +1247,11 @@ class VMwareAPIVMTestCase(test.NoDBTestCase): self.assertEqual(connector['initiator'], 'iscsi-name') self.assertNotIn('instance', connector) + def test_refresh_instance_security_rules(self): + self.assertRaises(NotImplementedError, + self.conn.refresh_instance_security_rules, + instance=None) + class VMwareAPIHostTestCase(test.NoDBTestCase): """Unit tests for Vmware API host calls.""" diff --git a/nova/virt/driver.py b/nova/virt/driver.py index da31f6b643..66d5077245 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -682,6 +682,15 @@ class ComputeDriver(object): # TODO(Vek): Need to pass context in for access to auth_token raise NotImplementedError() + def refresh_instance_security_rules(self, instance): + """Refresh security group rules + + Gets called when an instance gets added to or removed from + the security group the instance is a member of or if the + group gains or looses a rule. + """ + raise NotImplementedError() + def reset_network(self, instance): """reset networking for specified instance.""" # TODO(Vek): Need to pass context in for access to auth_token |