Creating RequestSpec from flavor tries to use nonexistent attribute

Bug #2008461 reported by Dominik Danelski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Opinion
Undecided
Unassigned

Bug Description

Description
===========
Calling RequestSpec.from_primitives, which in turn calls spec._from_flavor ends with "AttributeError: module 'nova.objects' has no attribute 'Flavor'" after the check "isinstance(flavor, objects.Flavor)"

Steps to reproduce
==================
* I directly imported RequestSpec via "from nova.objects.request_spec import RequestSpec" for testing purposes
* I called RequestSpec.from_primitives
* RequestSpec.from_primitives called RequestSpec._from_flavor to fill the missing information
* RequestSpec._from_flavor performed a check "isinstance(flavor, objects.Flavor)", which resulted in the exception

Expected result
===============
I should have received a RequestSpec object or another error if the data provided was incorrect.

Actual result
=============
The exception "AttributeError: module 'nova.objects' has no attribute 'Flavor'" is raised.

Traceback:
RequestSpec.from_primitives(scheduler_connector_nova_rpc._context, dictionary_from_json, {})
  File "/home/eouser/placement-simulation-tool/venv/lib/python3.10/site-packages/nova/objects/request_spec.py", line 331, in from_primitives
    spec._from_flavor(flavor)
  File "/home/eouser/placement-simulation-tool/venv/lib/python3.10/site-packages/nova/objects/request_spec.py", line 249, in _from_flavor
    if isinstance(flavor, objects.Flavor):
AttributeError: module 'nova.objects' has no attribute 'Flavor'

Environment
===========
I use Nova 21.2.4 from PyPi, Python 3.10 on Ubuntu 20.04.

Revision history for this message
Uggla (rene-ribaud) wrote :

Thanks for reporting this bug. It is legit, but it needs to be discussed as the RequestSpec.from_primitives method is deprecated and should be removed at some point. So we need to discuss whether it is worth fixing or simply removing the method.

Changed in nova:
status: New → Opinion
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.