[Openstack] nova periodic task can't use cinderclient because it has a blank context
Deng Kim
powerds at gmail.com
Thu May 15 00:33:26 UTC 2014
Hi all.
I have a question on icehouse release version of nova.
_reclaim_queued_deletes() method in /nova/compute/manager.py is a periodic
task.
And if I set cinder up in my openstack system, the method uses cinderclient
to call terminate_connection().
But sadly a context object used by the periodic task is blank context. no
tenant_id, no user_id, no auth_token...
So cinderclient returns error like this.
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File
"/usr/lib/python2.7/dist-packages/nova/openstack/common/periodic_task.py",
line 182, in run_periodic_tasks
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
task(self, context)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 5395,
in _reclaim_queued_deletes
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
self._delete_instance(context, instance, bdms)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/nova/hooks.py", line 103, in inner
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
rv = f(*args, **kwargs)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 2220,
in _delete_instance
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
user_id=user_id)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/nova/openstack/common/excutils.py",
line 68, in __exit__
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
six.reraise(self.type_, self.value, self.tb)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 2190,
in _delete_instance
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
self._shutdown_instance(context, db_inst, bdms)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 2136,
in _shutdown_instance
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
connector)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/nova/volume/cinder.py", line 179, in
wrapper
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
res = method(self, ctx, volume_id, *args, **kwargs)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/nova/volume/cinder.py", line 282, in
terminate_connection
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
connector)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/cinderclient/v1/volumes.py", line
331, in terminate_connection
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
{'connector': connector})
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/cinderclient/v1/volumes.py", line
250, in _action
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
return self.api.client.post(url, body=body)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/cinderclient/client.py", line 209,
in post
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
return self._cs_request(url, 'POST', **kwargs)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/cinderclient/client.py", line 167,
in _cs_request
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
self.authenticate()
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/cinderclient/client.py", line 312,
in authenticate
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
auth_url = self._v1_auth(auth_url)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/cinderclient/client.py", line 330,
in _v1_auth
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
resp, body = self.request(url, 'GET', headers=headers)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
File "/usr/lib/python2.7/dist-packages/cinderclient/client.py", line 156,
in request
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
raise exceptions.from_response(resp, body)
2014-05-14 18:28:17.527 24605 TRACE nova.openstack.common.periodic_task
Unauthorized: Unauthorized (HTTP 401)
Could you let me know how the method run well? or the way to fill the
context up?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20140515/2b5a094b/attachment.html>
More information about the Openstack
mailing list