Skip to content

Commit b729809

Browse files
committed
Remove hooks
This extension point was deprecated in 13.0.0 (Mitaka) as it was unmaintainable. Now, over four years later, it's finally time to remove them. A combination of notifications, versioned or otherwise, and dynamic vendordata should be used instead. Change-Id: Idb9a0c06d8abdb158bcee5be12c35dcb67257e60 Signed-off-by: Stephen Finucane <[email protected]>
1 parent 45a88f0 commit b729809

File tree

9 files changed

+113
-439
lines changed

9 files changed

+113
-439
lines changed

nova/compute/api.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
from nova.db.sqlalchemy import api as db_api
5959
from nova import exception
6060
from nova import exception_wrapper
61-
from nova import hooks
6261
from nova.i18n import _
6362
from nova.image import glance
6463
from nova.network import constants
@@ -1927,7 +1926,6 @@ def _check_multiple_instances_with_specified_ip(self, requested_networks):
19271926
"is specified.")
19281927
raise exception.InvalidFixedIpAndMaxCountRequest(reason=msg)
19291928

1930-
@hooks.add_hook("create_instance")
19311929
def create(self, context, instance_type,
19321930
image_href, kernel_id=None, ramdisk_id=None,
19331931
min_count=None, max_count=None,

nova/compute/manager.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
import nova.context
7474
from nova import exception
7575
from nova import exception_wrapper
76-
from nova import hooks
7776
from nova.i18n import _
7877
from nova.image import glance
7978
from nova import manager
@@ -2159,7 +2158,6 @@ def _check_trusted_certs(self, instance):
21592158
'Trusted image certificates provided on host that does not '
21602159
'support certificate validation.')
21612160

2162-
@hooks.add_hook('build_instance')
21632161
@wrap_exception()
21642162
@reverts_task_state
21652163
@wrap_instance_event(prefix='compute')
@@ -2949,7 +2947,6 @@ def _cleanup_volumes(self, context, instance, bdms, raise_exc=True,
29492947
if exc_info is not None and raise_exc:
29502948
six.reraise(exc_info[0], exc_info[1], exc_info[2])
29512949

2952-
@hooks.add_hook("delete_instance")
29532950
def _delete_instance(self, context, instance, bdms):
29542951
"""Delete an instance on this host.
29552952

nova/hooks.py

Lines changed: 0 additions & 167 deletions
This file was deleted.

nova/network/neutron.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
from nova import context as nova_context
3838
from nova.db import base
3939
from nova import exception
40-
from nova import hooks
4140
from nova.i18n import _
4241
from nova.network import constants
4342
from nova.network import model as network_model
@@ -102,7 +101,6 @@ def get_binding_profile(port):
102101
return port.get(constants.BINDING_PROFILE, {}) or {}
103102

104103

105-
@hooks.add_hook('instance_network_info')
106104
def update_instance_cache_with_nw_info(impl, context, instance, nw_info=None):
107105
if instance.deleted:
108106
LOG.debug('Instance is deleted, no further info cache update',

nova/test.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -748,12 +748,6 @@ class NoDBTestCase(TestCase):
748748
USES_DB = False
749749

750750

751-
class BaseHookTestCase(NoDBTestCase):
752-
def assert_has_hook(self, expected_name, func):
753-
self.assertTrue(hasattr(func, '__hook_name__'))
754-
self.assertEqual(expected_name, func.__hook_name__)
755-
756-
757751
class MatchType(object):
758752
"""Matches any instance of a specified type
759753

nova/tests/unit/compute/test_compute.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13425,18 +13425,3 @@ def test_cpu_thread_policy(self):
1342513425
self.compute_api._validate_flavor_image,
1342613426
self.context, image['id'], image, self.instance_type,
1342713427
None)
13428-
13429-
13430-
class ComputeHooksTestCase(test.BaseHookTestCase):
13431-
def test_delete_instance_has_hook(self):
13432-
delete_func = compute_manager.ComputeManager._delete_instance
13433-
self.assert_has_hook('delete_instance', delete_func)
13434-
13435-
def test_create_instance_has_hook(self):
13436-
create_func = compute.API.create
13437-
self.assert_has_hook('create_instance', create_func)
13438-
13439-
def test_build_instance_has_hook(self):
13440-
build_instance_func = (compute_manager.ComputeManager.
13441-
_do_build_and_run_instance)
13442-
self.assert_has_hook('build_instance', build_instance_func)

0 commit comments

Comments
 (0)