Host creation failed with the error "Remote error: ResourceProviderCreationFailed Failed to create resource provider blazar_<hostname>

Bug #1812642 reported by Niraj Singh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Blazar
Fix Released
Undecided
Tetsuro Nakamura

Bug Description

Description
===========

Getting below error while creating host:

ERROR blazar.api.v1.utils [-] Request aborted with status code 500 and message 'Internal Server Error': RemoteError: Remote error: ResourceProviderCreationFailed Failed to create resource provider <hostname>
 2019-01-21 06:49:33.110 3430 ERROR blazar.api.v1.utils [-] Traceback (most recent call last):
   File "/opt/stack/blazar/blazar/api/v1/utils.py", line 76, in handler
     return func(**kwargs)
   File "/opt/stack/blazar/blazar/api/v1/oshosts/v1_0.py", line 37, in computehosts_create
     return api_utils.render(host=_api.create_computehost(data))
   File "/opt/stack/blazar/blazar/utils/__init__.py", line 32, in __run_method
     return getattr(self.instance, __name)(*args, **kwargs)
   File "/opt/stack/blazar/blazar/policy.py", line 112, in wrapped
     return func(self, *args, **kwargs)
   File "/opt/stack/blazar/blazar/utils/trusts.py", line 93, in wrapped
     return func(self, to_update)
   File "/opt/stack/blazar/blazar/api/v1/oshosts/service.py", line 39, in create_computehost
     return self.manager_rpcapi.create_computehost(data)
   File "/opt/stack/blazar/blazar/manager/oshosts/rpcapi.py", line 47, in create_computehost
     host_values=host_values)
   File "/opt/stack/blazar/blazar/utils/service.py", line 44, in call
     return self._client.call(ctx.to_dict(), name, **kwargs)
   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/client.py", line 505, in call
     return self.prepare().call(ctxt, method, **kwargs)
   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/client.py", line 179, in call
     retry=self.retry)
   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/transport.py", line 128, in _send
     retry=retry)
   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/_drivers/amqpdriver.py", line 645, in send
     call_monitor_timeout, retry=retry)
   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/_drivers/amqpdriver.py", line 636, in _send
     raise result
 RemoteError: Remote error: ResourceProviderCreationFailed Failed to create resource provider blazar_niraj-virtualbox

Steps to reproduce
=================

1) Create host with command $blazar host-create <hostname> and after placement service creates resource provider and before host is created in Blazar restart the Blazar services forcefully.

2) After services successfully restart, try to create host again with above command ($blazar host-create <hostname>)

Expected result
===============

Host should create successfully

Actual result
=============

Request aborted with status code 500 and message 'Internal Server Error'.

Revision history for this message
Tetsuro Nakamura (tetsuro0907) wrote :

Before the placement support in rocky, this resulted in HTTP 409,
blazar.manager.exceptions.AggregateAlreadyHasHost: Aggregate freepool already has host(s) ubuntu01

Therefore I think we should change this back to HTTP 409 from 500 with better message that tells one that they have already created that host in Blazar.

Changed in blazar:
status: New → Confirmed
assignee: nobody → Tetsuro Nakamura (tetsuro0907)
Revision history for this message
Tetsuro Nakamura (tetsuro0907) wrote :

I'm going to submit a patch to address this, but remember that once you create the host, the host record is in the Blazar DB and the DB record is not cleared by restarting the service. IOW, the host is kept being "already created status" after restarting service, too, so I believe the expected result here is "HTTP 409:Conflict" rather than "HTTP 200", which is consistent with Rocky release behavior.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to blazar (master)

Fix proposed to branch: master
Review: https://review.openstack.org/632929

Changed in blazar:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to blazar (master)

Reviewed: https://review.openstack.org/632929
Committed: https://git.openstack.org/cgit/openstack/blazar/commit/?id=2bd5b65118323c17a5fdf146d9797df64e8d0924
Submitter: Zuul
Branch: master

commit 2bd5b65118323c17a5fdf146d9797df64e8d0924
Author: Tetsuro Nakamura <email address hidden>
Date: Tue Jan 22 20:39:53 2019 +0000

    Expose placement exception code to end users

    Attempting to create an existing host already in DB resulted in a 409
    Conflict response status code in the Rocky release. However, on the
    current master, using the placement API support has changed it to return
    a 500 Internal Server Error.

    This patch changes it back to 409 by bubbling up the exception code
    occured in the placement resource provider creation.

    Change-Id: I5c02a8fe9a83adf83358062fcc5470e38e643550
    Closes-Bug: #1812642

Changed in blazar:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/blazar 3.0.0.0rc1

This issue was fixed in the openstack/blazar 3.0.0.0rc1 release candidate.

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.