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'
Fix proposed to branch: master /review. openstack. org/504030
Review: https:/