Danger: An Error occurred. Please try again later

Bug #2077329 reported by Joao
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
In Progress
Undecided
Unassigned

Bug Description

Hello,

When attaching an interface to a VM via Horizon, I got the error 'Danger: An error occurred. Please try again later.' However, it works via the CLI.

horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294116 /usr/lib/python3.8/warnings.py:30: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294149 file.write(text)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294157 /usr/lib/python3.8/logging/__init__.py:1088: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294161 stream.write(msg + self.terminator)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294167 Internal Server Error: /project/instances/5266ef2b-3823-42a6-bc39-256f9f1f8671/attach_interface
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294170 Traceback (most recent call last):
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294173 File "/var/lib/openstack/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294177 response = get_response(request)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294180 File "/var/lib/openstack/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294183 response = wrapped_callback(request, *callback_args, **callback_kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294186 File "/var/lib/openstack/lib/python3.8/site-packages/horizon/decorators.py", line 51, in dec
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294189 return view_func(request, *args, **kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294195 File "/var/lib/openstack/lib/python3.8/site-packages/horizon/decorators.py", line 35, in dec
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294198 return view_func(request, *args, **kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294201 File "/var/lib/openstack/lib/python3.8/site-packages/horizon/decorators.py", line 35, in dec
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294204 return view_func(request, *args, **kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294207 File "/var/lib/openstack/lib/python3.8/site-packages/horizon/decorators.py", line 111, in dec
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294210 return view_func(request, *args, **kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294213 File "/var/lib/openstack/lib/python3.8/site-packages/horizon/decorators.py", line 83, in dec
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294216 return view_func(request, *args, **kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294220 File "/var/lib/openstack/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294224 return self.dispatch(request, *args, **kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294228 File "/var/lib/openstack/lib/python3.8/site-packages/django/views/generic/base.py", line 98, in dispatch
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294231 return handler(request, *args, **kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294234 File "/var/lib/openstack/lib/python3.8/site-packages/django/views/generic/edit.py", line 133, in get
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294238 return self.render_to_response(self.get_context_data())
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294245 File "/var/lib/openstack/lib/python3.8/site-packages/openstack_dashboard/dashboards/project/instances/views.py", line 635, in get_context_data
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294249 context = super().get_context_data(**kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294252 File "/var/lib/openstack/lib/python3.8/site-packages/horizon/forms/views.py", line 144, in get_context_data
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294256 context = super().get_context_data(**kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294259 File "/var/lib/openstack/lib/python3.8/site-packages/horizon/forms/views.py", line 77, in get_context_data
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294263 context = super().get_context_data(**kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294266 File "/var/lib/openstack/lib/python3.8/site-packages/horizon/forms/views.py", line 56, in get_context_data
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294270 context = super().get_context_data(**kwargs)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294273 File "/var/lib/openstack/lib/python3.8/site-packages/django/views/generic/edit.py", line 66, in get_context_data
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294277 kwargs['form'] = self.get_form()
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294281 File "/var/lib/openstack/lib/python3.8/site-packages/horizon/forms/views.py", line 179, in get_form
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294284 return form_class(self.request, **self.get_form_kwargs())
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294288 File "/var/lib/openstack/lib/python3.8/site-packages/openstack_dashboard/dashboards/project/instances/forms.py", line 337, in __init__
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294292 ports = instance_utils.port_field_data(request, with_network=True)
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294296 File "/var/lib/openstack/lib/python3.8/site-packages/openstack_dashboard/dashboards/project/instances/utils.py", line 208, in port_field_data
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294299 ports = [
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294302 File "/var/lib/openstack/lib/python3.8/site-packages/openstack_dashboard/dashboards/project/instances/utils.py", line 210, in <listcomp>
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294306 add_more_info_port_name(port, network_dict[port.network_id]))
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294310 KeyError: '1f2016ea-0094-4533-afff-677d66c09a11'

root@horizon-6dc8465ddc-9smwb:/# pip show horizon
Name: horizon
Version: 23.0.1.dev55
Summary: OpenStack Dashboard
Home-page: https://docs.openstack.org/horizon/latest/
Author: OpenStack
Author-email: <email address hidden>
License: UNKNOWN
Location: /var/lib/openstack/lib/python3.8/site-packages
Requires: pbr, oslo.policy, XStatic-smart-table, XStatic-jQuery, XStatic-bootswatch, PyYAML, oslo.i18n, keystoneauth1, XStatic-Angular-Gettext, XStatic-Angular, oslo.config, futurist, XStatic-D3, django-debreach, oslo.concurrency, enmerkar, semantic-version, XStatic-roboto-fontface, six, iso8601, Babel, pytz, XStatic-Rickshaw, oslo.utils, XStatic-Bootstrap-Datepicker, netaddr, XStatic-Font-Awesome, XStatic-Angular-Schema-Form, XStatic-mdi, pyScss, django-pyscss, debtcollector, XStatic-Angular-Bootstrap, XStatic-Hogan, pymongo, XStatic-Jasmine, XStatic-JQuery-Migrate, XStatic, python-novaclient, XStatic-JQuery.quicksearch, XStatic-term.js, XStatic-Angular-lrdragndrop, XStatic-Spin, python-swiftclient, python-glanceclient, oslo.upgradecheck, requests, python-keystoneclient, XStatic-JQuery.TableSorter, XStatic-jquery-ui, XStatic-Bootstrap-SCSS, oslo.serialization, XStatic-tv4, python-neutronclient, osprofiler, XStatic-objectpath, XStatic-JSEncrypt, django-compressor, Django, XStatic-Angular-FileUpload, python-cinderclient
Required-by: octavia-dashboard, neutron-vpnaas-dashboard, heat-dashboard, designate-dashboard

nova-api-metadata-5cfbfbb8f5-fh9jv:/$ pip show nova
Name: nova
Version: 26.2.2
Summary: Cloud computing fabric controller
Home-page: https://docs.openstack.org/nova/latest/
Author: OpenStack
Author-email: <email address hidden>
License: UNKNOWN
Location: /var/lib/openstack/lib/python3.8/site-packages
Requires: tooz, oslo.context, oslo.db, websockify, Jinja2, oslo.i18n, oslo.privsep, cryptography, python-dateutil, jsonschema, Paste, os-traits, python-cinderclient, oslo.versionedobjects, PyYAML, oslo.serialization, oslo.service, os-resource-classes, microversion-parse, futurist, oslo.rootwrap, openstacksdk, psutil, netifaces, retrying, oslo.log, oslo.utils, oslo.messaging, SQLAlchemy, PrettyTable, python-neutronclient, oslo.limit, oslo.cache, oslo.upgradecheck, iso8601, rfc3986, oslo.reports, os-vif, eventlet, alembic, packaging, oslo.concurrency, greenlet, os-service-types, keystoneauth1, oslo.middleware, paramiko, PasteDeploy, decorator, cursive, sqlalchemy-migrate, castellan, lxml, keystonemiddleware, netaddr, requests, os-brick, pbr, WebOb, python-glanceclient, stevedore, oslo.config, oslo.policy, Routes
Required-by:

nova-api-metadata-5cfbfbb8f5-fh9jv:/$ pip show microversion-parse
Name: microversion-parse
Version: 1.0.1
Summary: OpenStack microversion header parser
Home-page: http://www.openstack.org/
Author: OpenStack
Author-email: <email address hidden>
License: UNKNOWN
Location: /var/lib/openstack/lib/python3.8/site-packages
Requires: WebOb
Required-by: nova

Revision history for this message
Joao (jacpjr) wrote :

How to Reproduce:

1. Open the Horizon Dashboard.
2. Select a tenant project.
3. Go to Instances.
3. Click on "Attach Interface."

You will see the message: "Danger: An error occurred. Please try again later."

Horizon Logs:

The Horizon logs show entries like "KeyError: '711347d9-5027-4b36-9809-17274c6bb982'," where the ID represents a network in another tenant.

Workaround:

Create an RBAC rule to allow the network reported in the Horizon logs to be accessible by the project where you are facing the problem, in order to attach the interface.

Revision history for this message
eblock@nde.ag (eblock) wrote :

I have the same issue in Wallaby (openstack-dashboard version 19.4.0). The described RBAC workaround does not work for me. Other projects for the same user let me open the "attach_interface" dialog.

Revision history for this message
hwirths@nde.ag (hwirths) wrote :

As I can see, the problem here is the collection of ports available for attachment, in detail ports related to another project than the network they belong to.

The preparation of the interface attachment dialog includes the collection of available ports:

* Create a dictionary of the networks owned by the project
* Collect all ports owned by the project but not owned by a device
* For all such ports:
  + Create an info string with the name or id, respectively, and the IP address of the port
  + Extend the info string with the name or id, respectively, of the network the port belongs to

The last step will fail, if the port belongs to a network not owned by the project, because it is not part of the dictionary created in the first step. The dictionary lookup fails in such cases with messages like those shown in the initial comment of this bug:

--- cut here ---
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294306 add_more_info_port_name(port, network_dict[port.network_id]))
horizon-6dc8465ddc-9smwb horizon 2024-08-19 12:46:41.294310 KeyError: '1f2016ea-0094-4533-afff-677d66c09a11'
--- cut here ---

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

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/horizon/+/945987

Changed in horizon:
status: New → In Progress
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.