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

Bug #1689453 reported by wangchenglong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tacker
Invalid
Low
Rajat Sharma

Bug Description

in tacker.vnfm.infra_drivers.openstack.openstack.py 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:
            time.sleep(self.STACK_RETRY_WAIT)
            try:
                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})
                break
            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 *
                                     self.STACK_RETRY_WAIT),
                               stack=vnf_id)
            LOG.warning(_("VNF Creation failed: %(reason)s"),
                    {'reason': error_reason})
            raise vnfm.VNFCreateWaitFailed(vnf_id=vnf_id,
                                           reason=error_reason)

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

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

        # scaling enabled
        if vnf_dict['attributes'].get('scaling_group_names'):
            group_names = jsonutils.loads(
                vnf_dict['attributes'].get('scaling_group_names')).values()
            mgmt_ips = self._find_mgmt_ips_from_groups(heatclient,
                                                       vnf_id,
                                                       group_names)
        else:
            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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tacker (master)

Fix proposed to branch: master
Review: https://review.openstack.org/479164

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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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