get ns error in horizon when ns is deleted, response "Request Failed: internal server error while processing your request"

Bug #1708988 reported by jiangxing
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tacker
In Progress
High
jiangxing

Bug Description

When delete ns in horizon, get "Request Failed: internal server error while processing your request." refresh web, the ns is deleted.

Our version is ocata.

We used postman to send request for testing RESTful API.
method delete
url like this: http://10.190.3.82:9890/v1.0/nss/7a087701-604c-49e9-8320-acb71da75d28.json
The response is :
{
    "TackerError": "Request Failed: internal server error while processing your request."
}

The log is :

2017-08-07 20:07:57.751 1498 DEBUG tacker.alarm_receiver [req-d6ef08b1-001e-4227-a672-540c092fc871 - - - - -] Process request: (<Request at 0x7f274e4bdb50 DELETE http://10.190.3.82:9890/v1.0/nss/7a087701-604c-49e9-8320-acb71da75d28.json>,) process_request /usr/local/lib/python2.7/dist-packages/tacker/alarm_receiver.py:44
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource [req-236fd131-098e-4a4b-bf0f-4f21b65bea55 - - - - -] delete failed
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource Traceback (most recent call last):
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource File "/usr/local/lib/python2.7/dist-packages/tacker/api/v1/resource.py", line 81, in resource
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource result = method(request=request, **args)
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource File "/usr/local/lib/python2.7/dist-packages/tacker/api/v1/base.py", line 456, in delete
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource obj = self._item(request, id, parent_id=parent_id)
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource File "/usr/local/lib/python2.7/dist-packages/tacker/api/v1/base.py", line 311, in _item
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource obj = obj_getter(request.context, id, **kwargs)
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource File "/usr/local/lib/python2.7/dist-packages/tacker/db/nfvo/ns_db.py", line 336, in get_ns
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource ns_db = self._get_resource(context, NS, ns_id)
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource File "/usr/local/lib/python2.7/dist-packages/tacker/db/nfvo/nfvo_db.py", line 98, in _get_resource
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource return self._get_by_id(context, model, id)
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource File "/usr/local/lib/python2.7/dist-packages/tacker/db/db_base.py", line 134, in _get_by_id
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource return query.filter(model.id == id).one()
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2699, in one
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource raise orm_exc.NoResultFound("No row was found for one()")
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource NoResultFound: No row was found for one()
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource

And I found, both Nfvoplugin's parent classes nfvo_db.NfvoPluginDb and ns_db.NSPluginDb have the _get_resource. In ns_db.NsPluginDb.get_ns:

    def get_ns(self, context, ns_id, fields=None):
        ns_db = self._get_resource(context, NS, ns_id)
        return self._make_ns_dict(ns_db)

when self is from Nfvoplugin, it will call Nfvo_db._get_resource, because the class NfvoPlugin inherits in this order:

class NfvoPlugin(nfvo_db.NfvoPluginDb, vnffg_db.VnffgPluginDbMixin,
        ns_db.NSPluginDb)

but in nfvo_db.NfvoPluginDb._get_resource doesn't process the exception issubclass(model, NS).

    def _get_resource(self, context, model, id):
        try:
            return self._get_by_id(context, model, id)
        except orm_exc.NoResultFound:
            if issubclass(model, Vim):
                raise nfvo.VimNotFoundException(vim_id=id)
            else:
                raise

I think should indicate which parent class's _get_resource will be called in nfvoplugin's get_ns.

jiangxing (jiangxing)
description: updated
description: updated
Changed in tacker:
status: New → Confirmed
assignee: nobody → jiangxing (jiangxing)
description: updated
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/491490

Changed in tacker:
status: Confirmed → In Progress
Changed in tacker:
milestone: none → pike-rc1
importance: Undecided → High
jiangxing (jiangxing)
Changed in tacker:
status: In Progress → Fix Committed
Revision history for this message
yong sheng gong (gongysh) wrote :

It is not this way. the call stack trace is showing very clear.
the ns_db.get_ns is working well.

Revision history for this message
yong sheng gong (gongysh) wrote :

we should fix the error in horizon.

Revision history for this message
jiangxing (jiangxing) wrote :

But in ns_db.get_ns, self._get_resource call the nfvo_db._get_resource, the nfvo_db._get_resource doesn't process the issubclass(model, NS), it just raise.

2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource File "/usr/local/lib/python2.7/dist-packages/tacker/db/nfvo/ns_db.py", line 336, in get_ns
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource ns_db = self._get_resource(context, NS, ns_id)
2017-08-07 20:07:57.981 1498 ERROR tacker.api.v1.resource File "/usr/local/lib/python2.7/dist-packages/tacker/db/nfvo/nfvo_db.py", line 98, in _get_resource

Changed in tacker:
status: Fix Committed → In Progress
Changed in tacker:
milestone: pike-rc1 → queens-1
Changed in tacker:
milestone: queens-1 → queens-2
Changed in tacker:
milestone: queens-2 → queens-3
Revision history for this message
Trinh Nguyen (dangtrinhnt) wrote :

Does this still exist on queens? Or, can we move it to rocky?

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.