Got 'NoneType' traceback error with invalid id of network instance_id

Bug #1716860 reported by Eric Xie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Karbor
Fix Released
Undecided
Eric Xie

Bug Description

Description
===========
When i used non-existed instance_id for network protectable, got the all trace call.

Steps to reproduce
==================
* Setup devstack environment that enabled karbor
* Call RESTful API: GET http://172.23.59.194/data-protect/v1/14eeabc0a60f42108d56387289949dc6/protectables/OS::Neutron::Network/instances
{
    "instance": {
        "dependent_resources": [],
        "extra_info": null,
        "type": "OS::Neutron::Network",
        "id": "14eeabc0a60f42108d56387289949dc6",
        "name": "Network Topology"
    }
}
It was OK.
* Call http://172.23.59.194/data-protect/v1/14eeabc0a60f42108d56387289949dc6/protectables/OS::Neutron::Network/instances/aa

Expected result
===============
Got like: Invalid input: 'aa' is not instance of protectable 'OS::Neutron::Network'

Actual result
=============
"message": "'NoneType' object has no attribute 'to_dict'\nTraceback (most recent call last):\n\n File \"/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py\", line 160, in _process_incoming\n res = self.dispatcher.dispatch(message)\n\n File \"/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py\", line 213, in dispatch\n return self._do_dispatch(endpoint, method, ctxt, args)\n\n File \"/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py\", line 183, in _do_dispatch\n result = func(ctxt, **new_args)\n\n File \"/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py\", line 232, in inner\n return func(*args, **kwargs)\n\n File \"/opt/stack/karbor/karbor/services/protection/manager.py\", line 357, in show_protectable_instance\n return resource_instance.to_dict()\n\nAttributeError: 'NoneType' object has no attribute 'to_dict'\n",

Environment
===========
1. karbor version
# git log
commit e9160d22ce0c29955e2b505b35801b39cca2cb1d
Author: OpenStack Proposal Bot <email address hidden>
Date: Thu Sep 7 13:32:55 2017 +0000

    Updated from global requirements

    Change-Id: I9eea319acff02e37c0527149a2b019627d2f6701

Logs
==============
Response:
{
    "computeFault": {
        "message": "'NoneType' object has no attribute 'to_dict'\nTraceback (most recent call last):\n\n File \"/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py\", line 160, in _process_incoming\n res = self.dispatcher.dispatch(message)\n\n File \"/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py\", line 213, in dispatch\n return self._do_dispatch(endpoint, method, ctxt, args)\n\n File \"/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py\", line 183, in _do_dispatch\n result = func(ctxt, **new_args)\n\n File \"/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py\", line 232, in inner\n return func(*args, **kwargs)\n\n File \"/opt/stack/karbor/karbor/services/protection/manager.py\", line 357, in show_protectable_instance\n return resource_instance.to_dict()\n\nAttributeError: 'NoneType' object has no attribute 'to_dict'\n",
        "code": 500
    }
}

Sep 13 07:55:45 localhost karbor-protection: 2017-09-13 07:55:45.484 #033[01;31mERROR oslo_messaging.rpc.server [#033[01;36mreq-f12d8ef2-3d67-41b7-ab26-7197be1fed70 #033[00;36madmin None#033[01;31m] #033[01;35m#033[01;31mException during message handling#033[00m: AttributeError: 'NoneType' object has no attribute 'to_dict'
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00mTraceback (most recent call last):
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00m File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 160, in _process_incoming
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00m res = self.dispatcher.dispatch(message)
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00m File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 213, in dispatch
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00m return self._do_dispatch(endpoint, method, ctxt, args)
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00m File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 183, in _do_dispatch
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00m result = func(ctxt, **new_args)
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00m File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 232, in inner
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00m return func(*args, **kwargs)
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00m File "/opt/stack/karbor/karbor/services/protection/manager.py", line 357, in show_protectable_instance
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00m return resource_instance.to_dict()
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00mAttributeError: 'NoneType' object has no attribute 'to_dict'
Sep 13 07:55:45 localhost karbor-protection: #033[01;31m2017-09-13 07:55:45.484 TRACE oslo_messaging.rpc.server #033[01;35m#033[00m
Sep 13 07:55:45 localhost <email address hidden>: 2017-09-13 07:55:45.494 #033[00;36mINFO karbor.api.openstack.wsgi [#033[01;36mreq-f12d8ef2-3d67-41b7-ab26-7197be1fed70 #033[00;36madmin None#033[00;36m] #033[01;35m#033[00;36mHTTP exception thrown: 'NoneType' object has no attribute 'to_dict'

Eric Xie (eric-xie)
Changed in karbor:
assignee: nobody → Eric Xie (eric-xie)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to karbor (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to karbor (master)

Reviewed: https://review.openstack.org/504030
Committed: https://git.openstack.org/cgit/openstack/karbor/commit/?id=1f364aefa4114f913f5ff162a0c8fb1542b1cfdb
Submitter: Jenkins
Branch: master

commit 1f364aefa4114f913f5ff162a0c8fb1542b1cfdb
Author: ericxiett <eric_xiett@163.com>
Date: Thu Sep 14 18:54:20 2017 +0800

    Fix NoneType error when got non-exist instance of protectable.

    When calling show_resource() in protection.manager.ProtectionManager,
    the result may be None that got the NoneType has no attribute
     'to_dict'. This patch fixes it.

    Change-Id: I895fa492acbac8885cfb27640528280b69ba7c14
    Closes-Bug: #1716860

Changed in karbor:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/karbor 0.6.0

This issue was fixed in the openstack/karbor 0.6.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/karbor 1.0.0

This issue was fixed in the openstack/karbor 1.0.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/karbor 1.1.0

This issue was fixed in the openstack/karbor 1.1.0 release.

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.