Bug 2122936 - UnboundLocalError: local variable 'instance_uuid' referenced before assignment
Summary: UnboundLocalError: local variable 'instance_uuid' referenced before assignment
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-nova
Version: 17.1 (Wallaby)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ga
: 17.1
Assignee: melanie witt
QA Contact: OSP DFG:Compute
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-31 10:45 UTC by Attila Fazekas
Modified: 2023-08-16 01:12 UTC (History)
8 users (show)

Fixed In Version: openstack-nova-23.2.2-1.20220910120722.a9e8162.el9ost
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-08-16 01:12:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1940812 0 None None None 2022-09-07 00:17:48 UTC
OpenStack gerrit 828839 0 None NEW Avoid unbound instance_uuid var during delete 2022-09-07 00:17:48 UTC
Red Hat Issue Tracker OSP-18482 0 None None None 2022-08-31 10:49:18 UTC
Red Hat Product Errata RHEA-2023:4577 0 None None None 2023-08-16 01:12:31 UTC

Description Attila Fazekas 2022-08-31 10:45:50 UTC
Description of problem:
test_delete_server_while_in_building_state[id-9e6e0c87-3352-42f7-9faf-5d6210dbd159] test failed once.

chained exception:
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi [req-92cf26b5-0f10-47d2-af2a-a645ae742c91 0ae3aab856814e84922fb9ff904657e7 df1850a6fdb7451dbbab8db6303ff403 - default default] Unexpected exception in API method: UnboundLocalError: local variable 'instance_uuid' referenced before assignment
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi Traceback (most recent call last):
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/objects/instance.py", line 653, in destroy
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     db_inst = db.instance_destroy(self._context, self.uuid,
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/db/api.py", line 555, in instance_destroy
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     return IMPL.instance_destroy(context, instance_uuid,
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/db/sqlalchemy/api.py", line 178, in wrapper
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     return f(*args, **kwargs)
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/oslo_db/api.py", line 154, in wrapper
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     ectxt.value = e.inner_exc
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 227, in __exit__
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     self.force_reraise()
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 200, in force_reraise
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     raise self.value
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/oslo_db/api.py", line 142, in wrapper
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     return f(*args, **kwargs)
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/db/sqlalchemy/api.py", line 221, in wrapped
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     return f(context, *args, **kwargs)
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/db/sqlalchemy/api.py", line 1196, in instance_destroy
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     raise exception.ConstraintNotMet()
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi nova.exception.ConstraintNotMet: Constraint not met.
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi 
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi During handling of the above exception, another exception occurred:
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi 
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi Traceback (most recent call last):
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/compute/api.py", line 2236, in _delete
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     if self._delete_while_booting(context, instance):
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/compute/api.py", line 2178, in _delete_while_booting
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     instance.destroy()
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/oslo_versionedobjects/base.py", line 226, in wrapper
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     return fn(self, *args, **kwargs)
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/objects/instance.py", line 658, in destroy
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     raise exception.ObjectActionError(action='destroy',
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi nova.exception.ObjectActionError: Object action destroy failed because: host changed
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi 
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi During handling of the above exception, another exception occurred:
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi 
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi Traceback (most recent call last):
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/api/openstack/wsgi.py", line 658, in wrapped
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     return f(*args, **kwargs)
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/api/openstack/compute/servers.py", line 1082, in delete
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     self._delete(req.environ['nova.context'], req, id)
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/api/openstack/compute/servers.py", line 895, in _delete
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     self.compute_api.delete(context, instance)
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/compute/api.py", line 226, in inner
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     return function(self, context, instance, *args, **kwargs)
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/compute/api.py", line 153, in inner
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     return f(self, context, instance, *args, **kw)
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/compute/api.py", line 2563, in delete
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     self._delete_instance(context, instance)
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/compute/api.py", line 2554, in _delete_instance
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     self._delete(context, instance, 'delete', self._do_delete,
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi   File "/usr/lib/python3.9/site-packages/nova/compute/api.py", line 2278, in _delete
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi     self._local_delete_cleanup(context, instance_uuid)
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi UnboundLocalError: local variable 'instance_uuid' referenced before assignment
2022-08-31 04:00:17.708 9 ERROR nova.api.openstack.wsgi 
2022-08-31 04:00:17.714 9 INFO nova.api.openstack.wsgi [req-92cf2

Version-Release number of selected component (if applicable):
RHOS-17.0-RHEL-9-20220830.n.1

How reproducible:
Unknown, might be low

Comment 2 Attila Fazekas 2022-08-31 11:33:44 UTC
That test case is meant to try to trigger racy delete at early stages.

I guess the scheduler just picked a host in parallel,
what the delete was not handling  well.

Comment 3 melanie witt 2022-09-07 00:17:49 UTC
This has been fixed upstream and hasn't been backported to Wallaby yet.

I will review the change so that it can be merged.

Comment 4 melanie witt 2022-09-08 02:09:48 UTC
Upstream change has merged.

Comment 12 Lukas Svaty 2023-06-16 08:13:29 UTC
Bulk moving target milestone to GA after the release of Beta on 14th June '23.

Comment 19 errata-xmlrpc 2023-08-16 01:12:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Release of components for Red Hat OpenStack Platform 17.1 (Wallaby)), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2023:4577


Note You need to log in before you can comment on or make changes to this bug.