Fix missing vnfc resource updating on vnf respawn via SOL003-style Heal API call

Note: "SOL003-style" means a Heal API call without passing vnfcInstanceId
as the comment in FT source code states.

Related-Bug: #1886213
Change-Id: Ia6fe6b3179703f23266b71dd6595b75d1b801191
This commit is contained in:
Koichiro Den 2020-10-29 12:49:21 +09:00
parent 7e3f2d794d
commit d886ac7fec
3 changed files with 17 additions and 6 deletions

View File

@ -1333,9 +1333,8 @@ class Conductor(manager.Manager):
p_list)
def _update_placement(self, context, vnf_dict, vnf_instance):
self.vnfm_plugin.update_placement_constraint(context,
vnf_dict,
vnf_instance)
self.vnfm_plugin.update_placement_constraint_heal(
context, vnf_dict, vnf_instance)
def _delete_placement(self, context, vnf_instance_id):
self.vnfm_plugin.delete_placement_constraint(context,

View File

@ -609,9 +609,9 @@ class TestVnflcmDriver(db_base.SqlTestCase):
# Vnf resource software images will be created during
# instantiation.
self.assertEqual(1, mock_resource_create.call_count)
# Invoke will be called 6 times, 3 for deleting the vnf
# resources and 3 during instantiation.
self.assertEqual(6, self._vnf_manager.invoke.call_count)
# Invoke will be called 7 times, 3 for deleting the vnf
# resources and 4 during instantiation.
self.assertEqual(7, self._vnf_manager.invoke.call_count)
expected_msg = ("Request received for healing vnf '%s' "
"is completed successfully")
mock_log.info.assert_called_with(expected_msg,

View File

@ -544,10 +544,22 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
instantiate_vnf_request = objects.InstantiateVnfRequest.\
from_vnf_instance(vnf_instance)
vnf_instance.instantiated_vnf_info.reinitialize()
vnf_instance.task_state = fields.VnfInstanceTaskState.INSTANTIATING
vnfd_dict = vnflcm_utils._get_vnfd_dict(
context, vnf_instance.vnfd_id, instantiate_vnf_request.flavour_id)
vnflcm_utils._build_instantiated_vnf_info(
vnfd_dict, instantiate_vnf_request, vnf_instance,
vim_connection_info.vim_id)
try:
self._instantiate_vnf(context, vnf_instance, vnf_dict,
vim_connection_info, instantiate_vnf_request)
self._vnf_manager.invoke(
vim_connection_info.vim_type, 'post_vnf_instantiation',
context=context, vnf_instance=vnf_instance,
vim_connection_info=vim_connection_info)
except Exception as exc:
with excutils.save_and_reraise_exception() as exc_ctxt:
exc_ctxt.reraise = False