Merge "Add hook for network info update"
This commit is contained in:
commit
7d1c3d312a
@ -17,6 +17,7 @@ import functools
|
||||
import inspect
|
||||
|
||||
from nova.db import base
|
||||
from nova import hooks
|
||||
from nova.network import model as network_model
|
||||
from nova.objects import instance_info_cache as info_cache_obj
|
||||
from nova.openstack.common import excutils
|
||||
@ -27,6 +28,7 @@ from nova.openstack.common import log as logging
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@hooks.add_hook('instance_network_info')
|
||||
def update_instance_cache_with_nw_info(impl, context, instance,
|
||||
nw_info=None, update_cells=True):
|
||||
try:
|
||||
|
@ -399,3 +399,9 @@ class TestUpdateInstanceCache(test.TestCase):
|
||||
self.instance)
|
||||
db_mock.assert_called_once_with(self.context, self.instance['uuid'],
|
||||
{'network_info': self.nw_json})
|
||||
|
||||
|
||||
class NetworkHooksTestCase(test.BaseHookTestCase):
|
||||
def test_instance_network_info_hook(self):
|
||||
info_func = base_api.update_instance_cache_with_nw_info
|
||||
self.assert_has_hook('instance_network_info', info_func)
|
||||
|
Loading…
Reference in New Issue
Block a user