Description
===========
When i adopt a nova server(boot from image(create new volume)) use `openstack cluster node adopt` command, it was failed.
Steps to reproduce
==================
* create a new server(boot from image(create new volume))
* adopt the new server
# openstack cluster node adopt --identity bd71b832-e561-4f90-97b8-2949ec1415b0 --type os.nova.server-1.0 --name test_adopt_node-3
HttpException: u'\'id\'\n (HTTP 500) (Request-ID: req-c8b5e27e-5bfa-441f-8904-d71f0fb0355a), u'\'id\'\n
Expected result
===============
Command run successfully.
Actual result
=============
Command run failed, and raise HttpException.
Logs
==============
senlin-api logs:
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi [req-ffbca09b-e5a4-467d-865e-75d85d0bbce6 e1ddb7e7538845968789fd3a863de928 bdeecc1b58004bb19302da77ac056b44 - - -] Unexpected error occurred serving API: u'\'id\'\nTraceback (most recent call last):\n\n File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 163, in _process_incoming\n res = self.dispatcher.dispatch(message)\n\n File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 220, 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 190, in _do_dispatch\n result = func(ctxt, **new_args)\n\n File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 157, in wrapper\n result = f(*args, **kwargs)\n\n File "/opt/stack/senlin/senlin/engine/service.py", line 72, in wrapped\n return func(self, ctx, req_obj)\n\n File "/opt/stack/senlin/senlin/engine/service.py", line 1869, in node_adopt\n profile_cls, spec = self._node_adopt_preview(ctx, req)\n\n File "/opt/stack/senlin/senlin/engine/service.py", line 1823, in _node_adopt_preview\n snapshot=req.snapshot)\n\n File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 157, in wrapper\n result = f(*args, **kwargs)\n\n File "/opt/stack/senlin/senlin/profiles/base.py", line 284, in adopt_node\n return profile.do_adopt(obj, overrides=overrides, snapshot=snapshot)\n\n File "/opt/stack/senlin/senlin/profiles/os/nova/server.py", line 1371, in do_adopt\n spec[self.IMAGE] = server.image[\'id\'] or server.image\n\nKeyError: \'id\'\n': KeyError: u'\'id\'\nTraceback (most recent call last):\n\n File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 163, in _process_incoming\n res = self.dispatcher.dispatch(message)\n\n File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 220, 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 190, in _do_dispatch\n result = func(ctxt, **new_args)\n\n File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 157, in wrapper\n result = f(*args, **kwargs)\n\n File "/opt/stack/senlin/senlin/engine/service.py", line 72, in wrapped\n return func(self, ctx, req_obj)\n\n File "/opt/stack/senlin/senlin/engine/service.py", line 1869, in node_adopt\n profile_cls, spec = self._node_adopt_preview(ctx, req)\n\n File "/opt/stack/senlin/senlin/engine/service.py", line 1823, in _node_adopt_preview\n snapshot=req.snapshot)\n\n File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 157, in wrapper\n result = f(*args, **kwargs)\n\n File "/opt/stack/senlin/senlin/profiles/base.py", line 284, in adopt_node\n return profile.do_adopt(obj, overrides=overrides, snapshot=snapshot)\n\n File "/opt/stack/senlin/senlin/profiles/os/nova/server.py", line 1371, in do_adopt\n spec[self.IMAGE] = server.image[\'id\'] or server.image\n\nKeyError: \'id\'\n'
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi Traceback (most recent call last):
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi File "/opt/stack/senlin/senlin/api/common/wsgi.py", line 627, in __call__
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi request, **action_args)
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi File "/opt/stack/senlin/senlin/api/common/wsgi.py", line 703, in dispatch
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi return method(*args, **kwargs)
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi File "/opt/stack/senlin/senlin/api/common/wsgi.py", line 774, in version_select
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi return func.func(self, *args, **kwargs)
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi File "/opt/stack/senlin/senlin/api/common/util.py", line 42, in policy_checker
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi return handler(controller, req, **kwargs)
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi File "/opt/stack/senlin/senlin/api/openstack/v1/nodes.py", line 78, in adopt
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi node = self.rpc_client.call(req.context, 'node_adopt', obj)
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi File "/opt/stack/senlin/senlin/rpc/client.py", line 56, in call
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi return client.call(ctxt, method, req=req)
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/client.py", line 475, in call
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi return self.prepare().call(ctxt, method, **kwargs)
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/client.py", line 174, in call
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi retry=self.retry)
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi File "/usr/lib/python2.7/site-packages/oslo_messaging/transport.py", line 131, in _send
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi timeout=timeout, retry=retry)
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi File "/usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 559, in send
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi retry=retry)
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi File "/usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 550, in _send
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi raise result
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi KeyError: u'\'id\'\nTraceback (most recent call last):\n\n File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 163, in _process_incoming\n res = self.dispatcher.dispatch(message)\n\n File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 220, 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 190, in _do_dispatch\n result = func(ctxt, **new_args)\n\n File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 157, in wrapper\n result = f(*args, **kwargs)\n\n File "/opt/stack/senlin/senlin/engine/service.py", line 72, in wrapped\n return func(self, ctx, req_obj)\n\n File "/opt/stack/senlin/senlin/engine/service.py", line 1869, in node_adopt\n profile_cls, spec = self._node_adopt_preview(ctx, req)\n\n File "/opt/stack/senlin/senlin/engine/service.py", line 1823, in _node_adopt_preview\n snapshot=req.snapshot)\n\n File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 157, in wrapper\n result = f(*args, **kwargs)\n\n File "/opt/stack/senlin/senlin/profiles/base.py", line 284, in adopt_node\n return profile.do_adopt(obj, overrides=overrides, snapshot=snapshot)\n\n File "/opt/stack/senlin/senlin/profiles/os/nova/server.py", line 1371, in do_adopt\n spec[self.IMAGE] = server.image[\'id\'] or server.image\n\nKeyError: \'id\'\n'
2018-02-23 18:01:11.604 17706 ERROR senlin.api.common.wsgi
senlin-engine logs:
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server [req-ffbca09b-e5a4-467d-865e-75d85d0bbce6 e1ddb7e7538845968789fd3a863de928 bdeecc1b58004bb19302da77ac056b44 - - -] Exception during message handling: KeyError: 'id'
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server Traceback (most recent call last):
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 163, in _process_incoming
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server res = self.dispatcher.dispatch(message)
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 220, in dispatch
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server return self._do_dispatch(endpoint, method, ctxt, args)
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 190, in _do_dispatch
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server result = func(ctxt, **new_args)
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 157, in wrapper
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server result = f(*args, **kwargs)
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server File "/opt/stack/senlin/senlin/engine/service.py", line 72, in wrapped
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server return func(self, ctx, req_obj)
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server File "/opt/stack/senlin/senlin/engine/service.py", line 1869, in node_adopt
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server profile_cls, spec = self._node_adopt_preview(ctx, req)
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server File "/opt/stack/senlin/senlin/engine/service.py", line 1823, in _node_adopt_preview
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server snapshot=req.snapshot)
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 157, in wrapper
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server result = f(*args, **kwargs)
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server File "/opt/stack/senlin/senlin/profiles/base.py", line 284, in adopt_node
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server return profile.do_adopt(obj, overrides=overrides, snapshot=snapshot)
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server File "/opt/stack/senlin/senlin/profiles/os/nova/server.py", line 1371, in do_adopt
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server spec[self.IMAGE] = server.image['id'] or server.image
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server KeyError: 'id'
2018-02-23 18:01:11.600 18688 ERROR oslo_messaging.rpc.server
Fix proposed to branch: master /review. openstack. org/547364
Review: https:/