function create_wait(self, plugin, context, vnf_dict, vnf_id, auth_attr) parameter name changed

Bug #1689453 reported by wangchenglong on 2017-05-09
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rajat Sharma

Bug Description

in function,the parameter name "vnf_id" better change to "stack_id" in order to avoid misunderstanding here.

    def create_wait(self, plugin, context, vnf_dict, vnf_id, auth_attr):
        region_name = vnf_dict.get('placement_attr', {}).get(
            'region_name', None)
        heatclient = hc.HeatClient(auth_attr, region_name)

        stack = heatclient.get(vnf_id)
        status = stack.stack_status
        stack_retries = self.STACK_RETRIES
        error_reason = None
        while status == 'CREATE_IN_PROGRESS' and stack_retries > 0:
                stack = heatclient.get(vnf_id)
            except Exception:
                LOG.exception(_("VNF Instance cleanup may not have "
                                "happened because Heat API request failed "
                                "while waiting for the stack %(stack)s to be "
                                "deleted"), {'stack': vnf_id})
            status = stack.stack_status
            LOG.debug(_('status: %s'), status)
            stack_retries = stack_retries - 1

        LOG.debug(_('stack status: %(stack)s %(status)s'),
                  {'stack': str(stack), 'status': status})
        if stack_retries == 0 and status != 'CREATE_COMPLETE':
            error_reason = _("Resource creation is not completed within"
                           " {wait} seconds as creation of stack {stack}"
                           " is not completed").format(
                               wait=(self.STACK_RETRIES *
            LOG.warning(_("VNF Creation failed: %(reason)s"),
                    {'reason': error_reason})
            raise vnfm.VNFCreateWaitFailed(vnf_id=vnf_id,

        elif stack_retries != 0 and status != 'CREATE_COMPLETE':
            error_reason = stack.stack_status_reason
            raise vnfm.VNFCreateWaitFailed(vnf_id=vnf_id,

        def _find_mgmt_ips(outputs):
            LOG.debug(_('outputs %s'), outputs)
            mgmt_ips = dict((output['output_key'][len(OUTPUT_PREFIX):],
                            for output in outputs
                            if output.get('output_key',
            return mgmt_ips

        # scaling enabled
        if vnf_dict['attributes'].get('scaling_group_names'):
            group_names = jsonutils.loads(
            mgmt_ips = self._find_mgmt_ips_from_groups(heatclient,
            mgmt_ips = _find_mgmt_ips(stack.outputs)

        if mgmt_ips:
            vnf_dict['mgmt_url'] = jsonutils.dumps(mgmt_ips)

Changed in tacker:
importance: Undecided → Low
milestone: none → pike-2
status: New → Confirmed
tags: added: low-hanging-fruit
Changed in tacker:
assignee: nobody → venkatamahesh (venkatamaheshkotha)
Changed in tacker:
milestone: pike-2 → pike-3

Fix proposed to branch: master

Changed in tacker:
assignee: venkatamahesh (venkatamaheshkotha) → Rajat Sharma (tajar29)
status: Confirmed → In Progress
Changed in tacker:
status: In Progress → Invalid
milestone: pike-3 → none
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers