Comment 0 for bug 2025007

Revision history for this message
Masaki UENO (masaki-ueno) wrote :

Current implementation has the below bug:

`metadata` field in VnfInstanceV2 is accessed at [1] during DB synchronization.

```
    def _get_pod_information(self, resource_name,
            resource_type, vnf_instance, vim_connection_info):
        """Extract a Pod starting with the specified 'resource_name' name"""
        namespace = vnf_instance.metadata.get('namespace')
```

This field is optional (i.e. cardinality of this field is `0..1` in SOL002/003 specification), but this process has no None check. This results in a below bug when processing VNF instances with no `metadata` value.

```
2023-06-14 04:32:56.294 1 ERROR tacker.sol_refactored.conductor.conductor_v2 [None req-03b13adc-af42-4438-8bed-7ab72cf6e510 - - - - - -] Failed to synchronize database vnf: 399216ac-06bd-4ad6-8f54-ecc8e35f36b9 Error: Cannot load 'metadata' in the base class: NotImplementedError: Cannot load 'metadata' in the base class
```

We can resolve this issue by either one:

- Adding None check before this process
- Getting namespace from `vnf_instance.instantiatedVnfInfo.metadata['namespace']`

[1] https://github.com/openstack/tacker/blob/stable/2023.1/tacker/sol_refactored/infra_drivers/kubernetes/kubernetes_common.py#L319