http://logstash.openstack.org/#dashboard/file/logstash.json?query=message%3A%5C%22UserWarning%3A%20Cannot%20convert%20%3Coslo_db.sqlalchemy.enginefacade._Default%20object%20at%5C%22&from=7d
This shows up in nova functional test runs. This is the stacktrace from one of the tests:
2018-10-22 11:16:41,704 ERROR [root] Original exception being dropped: ['Traceback (most recent call last):\n', ' File "nova/exception_wrapper.py", line 69, in wrapped\n return f(self, context, *args, **kw)\n', ' File "nova/compute/utils.py", line 1157, in decorated_function\n return function(self, context, *args, **kwargs)\n', ' File "nova/compute/manager.py", line 216, in decorated_function\n kwargs[\'instance\'], e, sys.exc_info())\n', ' File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__\n self.force_reraise()\n', ' File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise\n six.reraise(self.type_, self.value, self.tb)\n', ' File "nova/compute/manager.py", line 204, in decorated_function\n return function(self, context, *args, **kwargs)\n', ' File "nova/compute/manager.py", line 6077, in check_can_live_migrate_destination\n block_migration, disk_over_commit)\n', ' File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1062, in __call__\n return _mock_self._mock_call(*args, **kwargs)\n', ' File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1128, in _mock_call\n ret_val = effect(*args, **kwargs)\n', ' File "nova/tests/functional/test_servers.py", line 2864, in fake_check_can_live_migrate_destination\n reason=\'test_live_migrate_pre_check_fails\')\n', 'MigrationPreCheckError: Migration pre-check error: test_live_migrate_pre_check_fails\n']
2018-10-22 11:16:41,704 ERROR [oslo_messaging.rpc.server] Exception during message handling
Traceback (most recent call last):
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 163, in _process_incoming
res = self.dispatcher.dispatch(message)
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 265, in dispatch
return self._do_dispatch(endpoint, method, ctxt, args)
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 194, in _do_dispatch
result = func(ctxt, **new_args)
File "nova/exception_wrapper.py", line 79, in wrapped
function_name, call_dict, binary, tb)
File "nova/exception_wrapper.py", line 33, in _emit_exception_notification
args)
File "nova/exception_wrapper.py", line 56, in _emit_legacy_exception_notification
notifier.error(context, function_name, payload)
File "nova/rpc.py", line 402, in _notify
getattr(self.notifier, priority)(ctxt, event_type, payload)
File "nova/tests/unit/fake_notifier.py", line 99, in _notify
payload = self._serializer.serialize_entity(ctxt, payload)
File "nova/rpc.py", line 134, in serialize_entity
return self._base.serialize_entity(context, entity)
File "nova/rpc.py", line 123, in serialize_entity
return jsonutils.to_primitive(entity, convert_instances=True)
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in to_primitive
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in <dictcomp>
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in to_primitive
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in <dictcomp>
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 181, in to_primitive
return recursive(value.__dict__, level=level + 1)
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in to_primitive
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in <dictcomp>
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 181, in to_primitive
return recursive(value.__dict__, level=level + 1)
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in to_primitive
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in <dictcomp>
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 181, in to_primitive
return recursive(value.__dict__, level=level + 1)
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in to_primitive
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in <dictcomp>
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in to_primitive
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 170, in <dictcomp>
for k, v in value.items()}
File "/home/osboxes/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_serialization/jsonutils.py", line 192, in to_primitive
"instead of warning in version 3.0" % (value,))
UserWarning: Cannot convert <oslo_db.sqlalchemy.enginefacade._Default object at 0x7f364c63f6a8> to primitive, will raise ValueError instead of warning in version 3.0
So there is something in the notification payload that has an instance of oslo_db.sqlalchemy.enginefacade._Default in it and the serializer doesn't know how to handle that. My guess would be there are versioned objects in the payload and those versioned objects have a context which has a db_connection engine facade in it, maybe because of using the CheatingSerializer fixture in nova?
This is the payload generated from the exception wrapper code:
{'args': {'block_migration': True, 'instance': Instance( access_ ip_v4=None, access_ ip_v6=None, architecture= 'x86_64' ,auto_disk_ config= False,availabil ity_zone= 'nova', cell_name= None,cleaned= False,config_ drive=' ',created_ at=2018- 10-22T15: 42:32Z, default_ ephemeral_ device= None,default_ swap_device= None,deleted= False,deleted_ at=None, device_ metadata= <?>,disable_ terminate= False,display_ description= None,display_ name='some- server' ,ec2_ids= <?>,ephemeral_ gb=0,ephemeral_ key_uuid= None,fault= <?>,flavor= <?>,host= 'host1' ,hostname= 'some-server' ,id=1,image_ ref='155d900f- 4e14-4e4c- a73d-069cbf4541 e6',info_ cache=InstanceI nfoCache, instance_ type_id= 1,kernel_ id='',key_ data=None, key_name= None,keypairs= <?>,launch_ index=0, launched_ at=2018- 10-22T15: 42:33Z, launched_ on='host1' ,locked= False,locked_ by=None, memory_ mb=512, metadata= {},migration_ context= <?>,new_ flavor= <?>,node= 'host1' ,numa_topology= <?>,old_ flavor= <?>,os_ type=None, pci_devices= <?>,pci_ requests= <?>,power_ state=1, progress= 0,project_ id='6f70656e737 461636b20342065 766572' ,ramdisk_ id='',reservati on_id=' r-irn39bnk' ,root_device_ name='/ dev/sda' ,root_gb= 1,security_ groups= SecurityGroupLi st,services= <?>,shutdown_ terminate= False,system_ metadata= {boot_roles= '',image_ architecture= 'x86_64' ,image_ base_image_ ref='155d900f- 4e14-4e4c- a73d-069cbf4541 e6',image_ container_ format= 'raw',image_ disk_format= 'raw',image_ kernel_ id='nokernel' ,image_ min_disk= '1',image_ ramdisk_ id='nokernel' ,owner_ project_ name=None, owner_user_ name=None} ,tags=< ?>,task_ state=' migrating' ,terminated_ at=None, trusted_ certs=< ?>,updated_ at=2018- 10-22T15: 42:33Z, user_data= None,user_ id='admin' ,uuid=cda73dc0- 0db6-4974- 8c46-26731b30d4 71,vcpu_ model=< ?>,vcpus= 1,vm_mode= None,vm_ state=' active' ), 'disk_over_commit': None, 'ctxt': <nova.context. RequestContext object at 0x7f5a2354bfd0>}, 'exception': {'kwargs': {'code': 500, 'reason': 'test_live_ migrate_ pre_check_ fails'} , 'class': 'MigrationPreCh eckError' , 'message': u'Migration pre-check error: test_live_ migrate_ pre_check_ fails'} }
https:/ /github. com/openstack/ nova/blob/ 6cec655a680bbaf d7e0d51e5bd97fa 88ec13c626/ nova/exception_ wrapper. py#L55
Those are the args from the ComputeManager. check_can_ live_migrate_ destination method called during the functional test.
So my guess is the fake notifier's serializer is trying to serialize a RequestContext, because it's an argument in the payload, and blows up since the db_connection engine factory is still in the request context object.