[SRU]"TypeError: catching classes that do not inherit from BaseException is not allowed" is raised if volume mount fails in python3
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| OpenStack Compute (nova) |
Fix Released
|
Medium
|
melanie witt | ||
| Antelope |
Fix Released
|
Undecided
|
Unassigned | ||
| Wallaby |
In Progress
|
Undecided
|
Unassigned | ||
| Xena |
In Progress
|
Undecided
|
Unassigned | ||
| Yoga |
In Progress
|
Undecided
|
Unassigned | ||
| Zed |
In Progress
|
Undecided
|
Unassigned | ||
| Ubuntu Cloud Archive |
Fix Released
|
Undecided
|
Unassigned | ||
| Yoga |
In Progress
|
Medium
|
Erlon R. Cruz | ||
| nova (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
| Jammy |
Fix Committed
|
Medium
|
Erlon R. Cruz | ||
Bug Description
*********** SRU TEMPLATE AT THE BOTTOM ***************
Saw this on a downstream CI run where a volume mount failed:
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
2022-07-29 11:56:57.606 2 ERROR nova.compute.
There's a piece of code in nova/virt/
This results in a TypeError in python3 but not in python2.
Python 2.7.18 (default, Jul 1 2022, 12:27:04)
[GCC 9.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> try:
... raise RuntimeError(
... except RuntimeError():
... print('hi')
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
RuntimeError: oops!
Python 3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> try:
... raise RuntimeError(
... except RuntimeError():
... print('hi')
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
RuntimeError: oops!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
TypeError: catching classes that do not inherit from BaseException is not allowed
===============
SRU DESCRIPTION
===============
[Impact]
This issue prevents attaching volumes to instances when using the cinder-nfs backend. The workaround is cumbersome and need admin access to the host to mount the nfs share manually.
[Test case]
1) Deploy OpenStack with Cinder NFS backend (not fully configured) and have a test image in glance
2) Create a volume and confirm it was created successfully afterwards
openstack volume create --size 1 v1
openstack volume list
3) Create an instance. Confirm successful creation.
openstack server create --flavor 6 --image cirros-0.4.0 --network private ins1
openstack server list
4) Attempt to attach the volume to the instance. Confirm it hasn't attached.
openstack server add volume ins1 v1
openstack volume list
5) Verify in logs the error message
except processutils.
TypeError: catching classes that do not inherit from BaseException is not allowed
6) install updated package
7) repeat step 4. It should not show that same error but a different error instead related to improper NFS mounting such as "permission denied".
[Where problems could occur]
The change is extremely trivial as a tiny python error and scope is limited to the mount operation for nfs storage backend, which is much less frequently used than other storage backends. It is also limited to the exception block, so if there is any error in the changed code, it should produce the same symptom as already observed (which is failure to process the exception when a mounting error occurs. If no mounting errors occur, the code should proceed fine).
[Other Info]
Related branches
- Guillaume Boutry (community): Approve
- Ubuntu OpenStack uploaders: Pending requested
-
Diff: 426 lines (+392/-0)5 files modifieddebian/changelog (+14/-0)
debian/patches/libvirt-Fix-regression-of-listDevices-return-type.patch (+166/-0)
debian/patches/libvirt-Wrap-un-proxied-listDevices-and-listAllDevic.patch (+132/-0)
debian/patches/lp1984736.patch (+77/-0)
debian/patches/series (+3/-0)
| description: | updated |
| summary: |
- "TypeError: catching classes that do not inherit from BaseException is - not allowed" is raised if volume mount fails in python3 + [SRU]"TypeError: catching classes that do not inherit from BaseException + is not allowed" is raised if volume mount fails in python3 |
| Changed in nova (Ubuntu): | |
| status: | New → Invalid |
| Changed in cloud-archive: | |
| status: | New → Invalid |
| description: | updated |
| Changed in nova (Ubuntu): | |
| status: | Invalid → Fix Released |
| Changed in nova (Ubuntu Jammy): | |
| assignee: | nobody → Rodrigo Barbieri (rodrigo-barbieri2010) |
| importance: | Undecided → Medium |
| status: | New → In Progress |
| Changed in cloud-archive: | |
| status: | Invalid → Fix Released |
| Changed in nova (Ubuntu Jammy): | |
| status: | Incomplete → In Progress |
| Changed in nova (Ubuntu Jammy): | |
| assignee: | Rodrigo Barbieri (rodrigo-barbieri2010) → Erlon R. Cruz (sombrafam) |

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