Comment 0 for bug 1940834

Revision history for this message
lmercl (lmercl) wrote :

In horizon on Wallaby and Victoria release, there are some view and function which are using ID value from Instance's Flavor part of JSON. The main issue is when you want to resize instance, you are receiving output below. The issue is also on Instance detail is specs, where Flavor is Not available. But on all instances view, this is working fine and base on detail of instance object and it's details, it looks like this view is using different methods based on older API.

We are running Wallaby dashboard with openstack-helm project with nova-api 2.88
Nova version:
{"versions": [{"id": "v2.0", "status": "SUPPORTED", "version": "", "min_version": "", "updated": "2011-01-21T11:33:21Z", "links": [{"rel": "self", "href": "http://nova.openstack.svc.cluster.local/v2/"}]}, {"id": "v2.1", "status": "CURRENT", "version": "2.88", "min_version": "2.1", "updated": "2013-07-23T11:33:21Z", "links": [{"rel": "self", "href": "http://nova.openstack.svc.cluster.local/v2.1/"}]}]})

For example for resize initialization the log output is:

2021-08-23 12:20:30.308473 Internal Server Error: /project/instances/a872bcc6-0a56-413a-9bea-b27dc006c707/resize
2021-08-23 12:20:30.308500 Traceback (most recent call last):
2021-08-23 12:20:30.308503 File "/var/lib/openstack/lib/python3.6/site-packages/horizon/utils/memoized.py", line 107, in wrapped
2021-08-23 12:20:30.308505 value = cache[key] = cache.pop(key)
2021-08-23 12:20:30.308507 KeyError: ((<weakref at 0x7fba91b35228; to 'ResizeView' at 0x7fba91b407b8>,), ())
2021-08-23 12:20:30.308509
2021-08-23 12:20:30.308512 During handling of the above exception, another exception occurred:
2021-08-23 12:20:30.308513
2021-08-23 12:20:30.308515 Traceback (most recent call last):
2021-08-23 12:20:30.308517 File "/var/lib/openstack/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2021-08-23 12:20:30.308519 response = get_response(request)
2021-08-23 12:20:30.308521 File "/var/lib/openstack/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
2021-08-23 12:20:30.308523 response = self.process_exception_by_middleware(e, request)
2021-08-23 12:20:30.308525 File "/var/lib/openstack/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
2021-08-23 12:20:30.308527 response = wrapped_callback(request, *callback_args, **callback_kwargs)
2021-08-23 12:20:30.308529 File "/var/lib/openstack/lib/python3.6/site-packages/horizon/decorators.py", line 52, in dec
2021-08-23 12:20:30.308531 return view_func(request, *args, **kwargs)
2021-08-23 12:20:30.308533 File "/var/lib/openstack/lib/python3.6/site-packages/horizon/decorators.py", line 36, in dec
2021-08-23 12:20:30.308534 return view_func(request, *args, **kwargs)
2021-08-23 12:20:30.308536 File "/var/lib/openstack/lib/python3.6/site-packages/horizon/decorators.py", line 36, in dec
2021-08-23 12:20:30.308538 return view_func(request, *args, **kwargs)
2021-08-23 12:20:30.308540 File "/var/lib/openstack/lib/python3.6/site-packages/horizon/decorators.py", line 112, in dec
2021-08-23 12:20:30.308542 return view_func(request, *args, **kwargs)
2021-08-23 12:20:30.308543 File "/var/lib/openstack/lib/python3.6/site-packages/horizon/decorators.py", line 84, in dec
2021-08-23 12:20:30.308545 return view_func(request, *args, **kwargs)
2021-08-23 12:20:30.308547 File "/var/lib/openstack/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
2021-08-23 12:20:30.308549 return self.dispatch(request, *args, **kwargs)
2021-08-23 12:20:30.308551 File "/var/lib/openstack/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch
2021-08-23 12:20:30.308553 return handler(request, *args, **kwargs)
2021-08-23 12:20:30.308554 File "/var/lib/openstack/lib/python3.6/site-packages/horizon/workflows/views.py", line 153, in get
2021-08-23 12:20:30.308556 context = self.get_context_data(**kwargs)
2021-08-23 12:20:30.308559 File "/var/lib/openstack/lib/python3.6/site-packages/openstack_dashboard/dashboards/project/instances/views.py", line 597, in get_context_data
2021-08-23 12:20:30.308561 context = super().get_context_data(**kwargs)
2021-08-23 12:20:30.308563 File "/var/lib/openstack/lib/python3.6/site-packages/horizon/workflows/views.py", line 91, in get_context_data
2021-08-23 12:20:30.308565 workflow = self.get_workflow()
2021-08-23 12:20:30.308567 File "/var/lib/openstack/lib/python3.6/site-packages/horizon/workflows/views.py", line 77, in get_workflow
2021-08-23 12:20:30.308570 extra_context = self.get_initial()
2021-08-23 12:20:30.308571 File "/var/lib/openstack/lib/python3.6/site-packages/openstack_dashboard/dashboards/project/instances/views.py", line 638, in get_initial
2021-08-23 12:20:30.308573 _object = self.get_object()
2021-08-23 12:20:30.308575 File "/var/lib/openstack/lib/python3.6/site-packages/horizon/utils/memoized.py", line 109, in wrapped
2021-08-23 12:20:30.308577 value = cache[key] = func(*args, **kwargs)
2021-08-23 12:20:30.308578 File "/var/lib/openstack/lib/python3.6/site-packages/openstack_dashboard/dashboards/project/instances/views.py", line 610, in get_object
2021-08-23 12:20:30.308583 flavor_id = instance.flavor['id']
2021-08-23 12:20:30.308586 KeyError: 'id'

For older version e.g. by this command:
curl -s -H "X-Auth-Token: $OS_TOKEN" -H "X-OpenStack-Nova-API-Version: 2.46" "http://nova-api:8774/v2.1/servers/{some server ID}" | python -mjson.tool

        "flavor": {
            "id": "2",
            "links": [
                {
                    "href": "http://185.22.97.118:30774/flavors/2",
                    "rel": "bookmark"
                }
            ]
        }

For current and >=2.47
curl -s -H "X-Auth-Token: $OS_TOKEN" -H "X-OpenStack-Nova-API-Version: 2.46" "http://nova-api:8774/v2.1/servers/{some server ID}" | python -mjson.tool

        "flavor": {
            "disk": 20,
            "ephemeral": 0,
            "extra_specs": {},
            "original_name": "m1.small",
            "ram": 2048,
            "swap": 0,
            "vcpus": 1
        }

This change in Nova is described:
https://specs.openstack.org/openstack/nova-specs/specs/pike/implemented/instance-flavor-api.html

Steps for reproduce:
1) init resize on Wallaby release with nova-api larger then 2.47

We are running the Horizon based on e.g. openstackhelm/horizon:wallaby-ubuntu_focal-20210823
with these versions:
python-cinderclient==7.4.0
python-dateutil==2.8.1
python-glanceclient==3.3.0
python-heatclient==2.3.0
python-keystoneclient==4.2.0
python-memcached==1.59
python-neutronclient==7.3.0
python-novaclient==17.4.0
python-swiftclient==3.11.1
openstacksdk==0.55.0