← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1517652] Re: Cannot handle glanceclient CommunicationError in Horizon

 

** Changed in: horizon
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1517652

Title:
  Cannot handle glanceclient CommunicationError in Horizon

Status in OpenStack Dashboard (Horizon):
  Fix Released

Bug description:
  When clicking on the "Launch instance" button, if glance client throws
  CommunicationError, although there is code  that tries to handle the
  exception, the UI still shows message "Danger: An error occurred.
  Please try again later.", not the error message from the exception
  handling code.

  The horizon log shows the following traceback when glance client
  throws a CommunicationError.

  2015-09-30 12:57:00,240 3549 ERROR django.request Internal Server Error: /horizon/project/instances/launch
  Traceback (most recent call last):
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 137, in get_response
      response = response.render()
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/django/template/response.py", line 105, in render
      self.content = self.rendered_content
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/django/template/response.py", line 82, in rendered_content
      content = template.render(context)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/django/template/base.py", line 140, in render
      return self._render(context)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/django/template/base.py", line 134, in _render
      return self.nodelist.render(context)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/django/template/base.py", line 840, in render
      bit = self.render_node(node, context)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/django/template/debug.py", line 78, in render_node
      return node.render(context)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/django/template/defaulttags.py", line 504, in render
      six.iteritems(self.extra_context)])
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/django/template/base.py", line 585, in resolve
      obj = self.var.resolve(context)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/django/template/base.py", line 735, in resolve
      value = self._resolve_lookup(context)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/django/template/base.py", line 789, in _resolve_lookup
      current = current()
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../horizon/workflows/base.py", line 717, in get_entry_point
      step._verify_contributions(self.context)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../horizon/workflows/base.py", line 392, in _verify_contributions
      field = self.action.fields.get(key, None)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../horizon/workflows/base.py", line 368, in action
      context)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/project/instances/workflows/create_instance.py", line 147, in __init__
      request, context, *args, **kwargs)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../horizon/workflows/base.py", line 138, in __init__
      self._populate_choices(request, context)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../horizon/workflows/base.py", line 151, in _populate_choices
      bound_field.choices = meth(request, context)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/project/instances/workflows/create_instance.py", line 446, in populate_instance_snapshot_id_choices
      self._images_cache)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/project/images/utils.py", line 44, in get_available_images
      _("Unable to retrieve public images."))
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../horizon/exceptions.py", line 364, in handle
      six.reraise(exc_type, exc_value, exc_traceback)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/project/images/utils.py", line 39, in get_available_images
      request, filters=public)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../openstack_dashboard/api/glance.py", line 104, in image_list_detailed
      images = list(images_iter)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../glanceclient/v1/images.py", line 249, in list
      for image in paginate(params, return_request_id):
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../glanceclient/v1/images.py", line 233, in paginate
      images, resp = self._list(url, "images")
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../glanceclient/v1/images.py", line 63, in _list
      resp, body = self.client.get(url)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../glanceclient/common/http.py", line 279, in get
      return self._request('GET', url, **kwargs)
    File "/opt/stack/horizon/venv/lib/python2.7/site-packages/openstack_dashboard/wsgi/../../glanceclient/common/http.py", line 260, in _request
      raise exc.CommunicationError(message=message)
  CommunicationError: Error finding address for https://glance.ash2.symcpe.net/v1/images/detail?sort_key=created_at&sort_dir=desc&status=active&limit=1000&is_public=True: ('Connection aborted.', BadStatusLine("''",))

  
  From the exception handling code (openstack_dashboard/dashboards/project/images/utils.py line 44) I can see that the correct message should be  "Unable to retrieve public images.". However, the UI shows "Danger: An error occurred. Please try again later." instead. This is because CommucationError is not registered in horizon and cannot be recognized by the code.

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1517652/+subscriptions


References