Fix and avoid an erroneous heat API call

When the vnf maintenance plugin's implementation of
project_instance_pre() is called, vnf instance id is likely to be empty
because, for instance, the stack creation itself has not been done for
some reason.

This resolves a FT failue: vnfm.test_vnf_placement_policy.VnfTestCreate
.test_vnf_with_placement_policy_invalid. _get_instances_with_openstack()
is called on the cleanup path (delete_vnfd), though the vnf instance id
is not present because create_vnf must have failed due to the invalid
placement policy. And you must have seen the following error message in
the tacker-server log: "heatclient.exc.HTTPNotFound: ERROR:
The Stack (None) could not be found.", which masked the expected
tacker.extensions.vnfm.HeatClientException: "["invalid"] is not an
allowed value ["anti-affinity", "affinity", "soft-anti-affinity",
"soft-affinity"].

Related-Bug: #1886213
Change-Id: I8bd2f7e021476470df6131a7ac8abd402e6e1bd1
changes/81/760281/3
Koichiro Den 2 years ago
parent 25f93312c1
commit 3798c9f925
  1. 3
      tacker/plugins/fenix.py

@ -415,6 +415,9 @@ class FenixPlugin(object):
return attrs
instances = []
if not vnf_dict['instance_id']:
return instances
client = self._get_openstack_clients(context, vnf_dict)
resources = client.heat.resources.list(vnf_dict['instance_id'],
nested_depth=2)

Loading…
Cancel
Save