_get_ironic_client should catch NotImplement exception and handle it

Bug #1414522 reported by Yuiko Takada
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Yuiko Takada

Bug Description

When call os-baremetal-nodes API at the environment in which ironic is not enable,
internal error occurs like below.

Traceback (most recent call last):
  File "tempest/api/compute/admin/test_baremetal.py", line 34, in test_list_baremetal_nodes
    baremetal_nodes = self.client.list_baremetal_nodes()
  File "tempest/services/compute/json/baremetal_client.py", line 33, in list_baremetal_nodes
    resp, body = self.get(url)
  File "/usr/local/lib/python2.7/dist-packages/tempest_lib/common/rest_client.py", line 171, in get
    return self.request('GET', url, extra_headers, headers)
  File "tempest/common/service_client.py", line 83, in request
    raise exceptions.ServerFault(ex)
ServerFault: Got server fault
Details: Got server fault
Details: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<type 'exceptions.AttributeError'>

http://logs.openstack.org/25/149125/1/check/check-tempest-dsvm-nova-v21-full/86687c5/logs/testr_results.html.gz

nova-api's error log is below.

2015-01-22 03:12:47.894 18727 TRACE nova.api.openstack.extensions Traceback (most recent call last):
2015-01-22 03:12:47.894 18727 TRACE nova.api.openstack.extensions File "/opt/stack/new/nova/nova/api/openstack/extensions.py", line 451, in wrapped
2015-01-22 03:12:47.894 18727 TRACE nova.api.openstack.extensions return f(*args, **kwargs)
2015-01-22 03:12:47.894 18727 TRACE nova.api.openstack.extensions File "/opt/stack/new/nova/nova/api/openstack/compute/plugins/v3/baremetal_nodes.py", line 97, in ind
ex
2015-01-22 03:12:47.894 18727 TRACE nova.api.openstack.extensions icli = _get_ironic_client()
2015-01-22 03:12:47.894 18727 TRACE nova.api.openstack.extensions File "/opt/stack/new/nova/nova/api/openstack/compute/plugins/v3/baremetal_nodes.py", line 69, in _get_ironic_client
2015-01-22 03:12:47.894 18727 TRACE nova.api.openstack.extensions icli = ironic_client.get_client(CONF.ironic.api_version, **kwargs)
2015-01-22 03:12:47.894 18727 TRACE nova.api.openstack.extensions AttributeError: 'NoneType' object has no attribute 'get_client'
2015-01-22 03:12:47.894 18727 TRACE nova.api.openstack.extensions
2015-01-22 03:12:47.895 INFO nova.api.openstack.wsgi [req-dc985e8a-edc5-4d34-9424-50c424e5a55c BaremetalAdminTestJSON-1435782774 BaremetalAdminTestJSON-219186341] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<type 'exceptions.AttributeError'>

We should catch NotImplement exception and handle it.

Changed in nova:
assignee: nobody → Yuiko Takada (takada-yuiko)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

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

Reviewed: https://review.openstack.org/149919
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b77b11b0d47b5ee87889652d328dfb05c4e39866
Submitter: Jenkins
Branch: master

commit b77b11b0d47b5ee87889652d328dfb05c4e39866
Author: YuikoTakada <email address hidden>
Date: Mon Jan 26 03:59:30 2015 +0000

    Handle ironic_client non-existent case

    When call os-baremetal-nodes API at the environment
    in which ironic is not enable, internal error occurs
    because ironicclient module doesn't exist.
    This patch set fixes this bug by raising HTTPNotImplemented in such a case.

    Change-Id: I64cf5a2b38b729dbdeb68887f0ddf0866e9679a0
    Closes-Bug: #1414522

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-2 → 2015.1.0
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.