Can't create a host when using a differen project than what blazar is setup with

Bug #1881228 reported by Sam Morrison
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Blazar
New
Undecided
Unassigned

Bug Description

It looks like blazar assumes that the user/project initiating a host-create command will be the same as the os_admin credentials specified in blazar.conf

If not host-create fails with the following error

2020-05-29 13:06:33.560 30541 ERROR blazar.api.v1.utils [-] Traceback (most recent call last):
  File "/opt/blazar/blazar/api/v1/utils.py", line 86, in handler
    return func(**kwargs)
  File "/opt/blazar/blazar/api/v1/oshosts/v1_0.py", line 42, in computehosts_create
    return api_utils.render(host=_api.create_computehost(data))
  File "/opt/blazar/blazar/utils/__init__.py", line 32, in __run_method
    return getattr(self.instance, __name)(*args, **kwargs)
  File "/opt/blazar/blazar/policy.py", line 112, in wrapped
    return func(self, *args, **kwargs)
  File "/opt/blazar/blazar/utils/trusts.py", line 93, in wrapped
    setattr(to_update, 'trust_id', trust.id)
  File "/opt/blazar/blazar/api/v1/oshosts/service.py", line 39, in create_computehost
    return self.manager_rpcapi.create_computehost(data)
  File "/opt/blazar/blazar/manager/oshosts/rpcapi.py", line 47, in create_computehost
    host_values=host_values)
  File "/opt/blazar/blazar/utils/service.py", line 44, in call
    return self._client.call(ctx.to_dict(), name, **kwargs)
  File "/opt/stein/lib/python3.6/site-packages/oslo_messaging/rpc/client.py", line 504, in call
    return self.prepare().call(ctxt, method, **kwargs)
  File "/opt/stein/lib/python3.6/site-packages/oslo_messaging/rpc/client.py", line 178, in call
    retry=self.retry)
  File "/opt/stein/lib/python3.6/site-packages/oslo_messaging/transport.py", line 128, in _send
    retry=retry)
  File "/opt/stein/lib/python3.6/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 645, in send
    call_monitor_timeout, retry=retry)
  File "/opt/stein/lib/python3.6/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 636, in _send
    raise result
oslo_messaging.rpc.client.RemoteError: Remote error: BadRequest Malformed request URL: URL's project_id '9427903ca1544f0795ba4117d55ed9b2' doesn't match Context's project_id '2f3e9e705b0b460b9de90d9844e88fd2' (HTTP 400) (Request-ID: req-ee174a23-7a4d-45ff-9847-2cbb740261ed)

Revision history for this message
Pierre Riteau (priteau) wrote :

I believe this may be solved by removing /%(tenant_id)s from Nova endpoints. See
https://opendev.org/openstack/kolla-ansible/commit/82551a2bfb62049cf7503fd2a543697ff7f4b7d4 for how this was changed in Kolla Ansible. If this is not an appropriate solution we would need to allow to provide a custom Nova endpoint URL via blazar.conf. I don't remember whether that's already possible or not.

Revision history for this message
Sam Morrison (sorrison) wrote :

I don't think that is the right approach. I've been having a look how this is done and want to refactor it a bit but haven't had time.

In the meantime https://github.com/NeCTAR-RC/blazar/commit/a92232ea2d4d53cb19f8b8251689ebb7ef8aff7c is a simple fix that does the job and gets us moving forward.

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.