Instantiate rollback fails in Terraform infra-driver

Bug #2040338 reported by Naoaki Horie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tacker
Fix Released
Undecided
Naoaki Horie

Bug Description

When perform an instantiate rollback after Instantiate operation failed, the following error message is output in the tacker conductor logs and the operation fails.

```
ERROR tacker.sol_refactored.conductor.conductor_v2 [req-c3fd15c6-652d-4e75-b562-2a9828b78484 nfv_user nfv] ROLLING_BACK INSTANTIATE failed: NotImplementedError: Cannot load 'instantiatedVnfInfo' in the base class
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 Traceback (most recent call last):
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 File "/opt/stack/tacker/tacker/sol_refactored/conductor/conductor_v2.py", line 285, in _rollback_lcm_op
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 self.vnflcm_driver.rollback(context, lcmocc, inst, grant_req,
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 File "/opt/stack/tacker/tacker/sol_refactored/conductor/vnflcm_driver_v2.py", line 253, in rollback
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 method(context, lcmocc, inst, grant_req, grant, vnfd)
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 File "/opt/stack/tacker/tacker/sol_refactored/conductor/vnflcm_driver_v2.py", line 454, in instantiate_rollback
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 driver.instantiate_rollback(req, inst, grant_req, grant, vnfd)
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 File "/opt/stack/tacker/tacker/sol_refactored/infra_drivers/terraform/terraform.py", line 125, in instantiate_rollback
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 self.terminate(req, inst, grant_req, grant, vnfd)
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 File "/opt/stack/tacker/tacker/sol_refactored/infra_drivers/terraform/terraform.py", line 92, in terminate
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 tf_var_path = inst.instantiatedVnfInfo.metadata['tf_var_path']
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 File "/usr/local/lib/python3.8/dist-packages/oslo_versionedobjects/base.py", line 67, in getter
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 self.obj_load_attr(name)
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 File "/usr/local/lib/python3.8/dist-packages/oslo_versionedobjects/base.py", line 600, in obj_load_attr
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 raise NotImplementedError(
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2 NotImplementedError: Cannot load 'instantiatedVnfInfo' in the base class
1944876 ERROR tacker.sol_refactored.conductor.conductor_v2
```

In the instantiate rollback process of current Terraform InfraDriver, just calling the terminate function.

https://github.com/openstack/tacker/blob/master/tacker/sol_refactored/infra_drivers/terraform/terraform.py#L112-L114
```
    def instantiate_rollback(self, req, inst, grant_req, grant, vnfd):
        '''Calls terminate'''
        self.terminate(req, inst, grant_req, grant, vnfd)
```

https://github.com/openstack/tacker/blob/master/tacker/sol_refactored/infra_drivers/terraform/terraform.py#L79C1-L85C65
```
    def terminate(self, req, inst, grant_req, grant, vnfd):
        '''Terminates the terraform resources managed by the current project'''

        vim_conn_info = inst_utils.select_vim_info(inst.vimConnectionInfo)
        working_dir = f"{CONF.v2_vnfm.tf_file_dir}/{inst.id}"
        tf_var_path = inst.instantiatedVnfInfo.metadata['tf_var_path'] <-- Error here
        self._terminate(vim_conn_info, working_dir, tf_var_path)
```

However, "instantiatedVnfInfo" is configure and saved at the LCM operation ends, so "instantiatedVnfInfo" may not be configure depending on the timing of the failure. Therefore, it's better that needed infromation gets from "InstantiateVnfRequest" instead of "instantiatedVnfInfo" in instantiation rollback operation.

Changed in tacker:
assignee: nobody → Naoaki Horie (naoaki-horie)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tacker (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/tacker/+/899110

Changed in tacker:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tacker (master)

Reviewed: https://review.opendev.org/c/openstack/tacker/+/899110
Committed: https://opendev.org/openstack/tacker/commit/f40a63e49cd762c8774492b0139f173dbb94bf0f
Submitter: "Zuul (22348)"
Branch: master

commit f40a63e49cd762c8774492b0139f173dbb94bf0f
Author: Naoaki Horie <email address hidden>
Date: Wed Oct 25 01:47:11 2023 +0000

    Fix Terraform infra-driver instantiate rollback

    This patch fixes instantiate rollback operation fails for
    Terraform infra-driver. The main fixes are as follows:

    - Change it to use "InstantiateVnfRequest" instead of
      "instantiatedVnfInfo". This is for bug fixes.
    - Organized the conditions for call of terminate function.
      This is because terminate operation fails depending on
      the timing of the failure.

    Also, functional test for instantiate rollback operation is not
    implemented in current Terraform infra-driver, so add it.

    Closes-Bug: #2040338
    Change-Id: Id22a77da5825edabfa5358ea68df0cf92bc9c17f

Changed in tacker:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tacker 11.0.0.0rc1

This issue was fixed in the openstack/tacker 11.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.