[Bug 1984736] Re: "TypeError: catching classes that do not inherit from BaseException is not allowed" is raised if volume mount fails in python3

Rodrigo Barbieri 1984736 at bugs.launchpad.net
Mon Jan 27 20:11:06 UTC 2025


** Description changed:

+ *********** 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.manager [req-67e1cef8-e30a-4a47-8010-9e966fd30fce 8882186b6a324a0e9fb6fd268d337cce 8b290d651e9b42fd89c95b5e2a9a25fb - default default] [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Failed to attach 5a6a5f37-0888-44b2-9456-cf087ae8c356 at /dev/vdb: TypeError: catching classes that do not inherit from BaseException is not allowed
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Traceback (most recent call last):
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/volume/mount.py", line 305, in mount
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     nova.privsep.fs.mount(fstype, export, mountpoint, options)
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/oslo_privsep/priv_context.py", line 247, in _wrap
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     return self.channel.remote_call(name, args, kwargs)
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/oslo_privsep/daemon.py", line 224, in remote_call
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     raise exc_type(*result[2])
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] oslo_concurrency.processutils.ProcessExecutionError: Unexpected error while running command.
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Command: mount -t nfs 192.168.1.50:/vol_cinder /var/lib/nova/mnt/724dab229d80c6a1a1e49a71c8356eed
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Exit code: 32
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Stdout: ''
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Stderr: 'Failed to connect to bus: No data available\nmount.nfs: Operation not permitted\n'
- 2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] 
+ 2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] During handling of the above exception, another exception occurred:
- 2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] 
+ 2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Traceback (most recent call last):
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/compute/manager.py", line 7023, in _attach_volume
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     bdm.attach(context, instance, self.volume_api, self.driver,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/block_device.py", line 46, in wrapped
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     ret_val = method(obj, context, *args, **kwargs)
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/block_device.py", line 672, in attach
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     self._do_attach(context, instance, volume, volume_api,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/block_device.py", line 657, in _do_attach
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     self._volume_attach(context, volume, connector, instance,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/block_device.py", line 606, in _volume_attach
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     volume_api.attachment_delete(context,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 227, in __exit__
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     self.force_reraise()
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 200, in force_reraise
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     raise self.value
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/block_device.py", line 595, in _volume_attach
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     virt_driver.attach_volume(
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/driver.py", line 2052, in attach_volume
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     self._connect_volume(context, connection_info, instance,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/driver.py", line 1794, in _connect_volume
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     vol_driver.connect_volume(connection_info, instance)
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/volume/fs.py", line 113, in connect_volume
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     mount.mount(self.fstype, export, vol_name, mountpoint, instance,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/volume/mount.py", line 407, in mount
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     mount_state.mount(fstype, export, vol_name, mountpoint, instance,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/volume/mount.py", line 306, in mount
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     except processutils.ProcessExecutionError():
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] TypeError: catching classes that do not inherit from BaseException is not allowed
  
  There's a piece of code in nova/virt/libvirt/volume/mount.py that is
  catching an instance of a class instead of a class [1]:
  
-                 try:
-                     nova.privsep.fs.mount(fstype, export, mountpoint, options)
-                 except processutils.ProcessExecutionError():
+                 try:
+                     nova.privsep.fs.mount(fstype, export, mountpoint, options)
+                 except processutils.ProcessExecutionError():
  
  This results in a TypeError in python3 but not in python2.
  
- Python 2.7.18 (default, Jul  1 2022, 12:27:04) 
+ 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('oops!')
  ... except RuntimeError():
  ...     print('hi')
- ... 
+ ...
  Traceback (most recent call last):
-   File "<stdin>", line 2, in <module>
+   File "<stdin>", line 2, in <module>
  RuntimeError: oops!
  
- Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
+ 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('oops!')
  ... except RuntimeError():
  ...     print('hi')
- ... 
+ ...
  Traceback (most recent call last):
-   File "<stdin>", line 2, in <module>
+   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>
+   File "<stdin>", line 3, in <module>
  TypeError: catching classes that do not inherit from BaseException is not allowed
  
  [1]
  https://github.com/openstack/nova/blob/1220d53c2fd6231bb569a54f004a0e858536e970/nova/virt/libvirt/volume/mount.py#L309
+ 
+ ===============
+ 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 backendand 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.ProcessExecutionError():
+ 
+ TypeError: catching classes that do not inherit from BaseException is
+ not allowed
+ 
+ 6) install updated package
+ 
+ 7) repeat step 4. It should attach successfully this time.
+ 
+ [Regression Potential]
+ 
+ The change is extremely trivial as a tiny python error. Absolutely zero
+ regression potential.
+ 
+ 
+ [Other Info]

** Summary changed:

- "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

** Also affects: nova (Ubuntu)
   Importance: Undecided
       Status: New

** Also affects: nova (Ubuntu Jammy)
   Importance: Undecided
       Status: New

** Changed in: nova (Ubuntu)
       Status: New => Invalid

** Also affects: cloud-archive
   Importance: Undecided
       Status: New

** Also affects: cloud-archive/yoga
   Importance: Undecided
       Status: New

** Changed in: cloud-archive
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to nova in Ubuntu.
https://bugs.launchpad.net/bugs/1984736

Title:
  [SRU]"TypeError: catching classes that do not inherit from
  BaseException is not allowed" is raised if volume mount fails in
  python3

Status in Ubuntu Cloud Archive:
  Invalid
Status in Ubuntu Cloud Archive yoga series:
  New
Status in OpenStack Compute (nova):
  Fix Released
Status in OpenStack Compute (nova) antelope series:
  Fix Released
Status in OpenStack Compute (nova) wallaby series:
  In Progress
Status in OpenStack Compute (nova) xena series:
  In Progress
Status in OpenStack Compute (nova) yoga series:
  In Progress
Status in OpenStack Compute (nova) zed series:
  In Progress
Status in nova package in Ubuntu:
  Invalid
Status in nova source package in Jammy:
  New

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.manager [req-67e1cef8-e30a-4a47-8010-9e966fd30fce 8882186b6a324a0e9fb6fd268d337cce 8b290d651e9b42fd89c95b5e2a9a25fb - default default] [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Failed to attach 5a6a5f37-0888-44b2-9456-cf087ae8c356 at /dev/vdb: TypeError: catching classes that do not inherit from BaseException is not allowed
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Traceback (most recent call last):
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/volume/mount.py", line 305, in mount
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     nova.privsep.fs.mount(fstype, export, mountpoint, options)
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/oslo_privsep/priv_context.py", line 247, in _wrap
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     return self.channel.remote_call(name, args, kwargs)
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/oslo_privsep/daemon.py", line 224, in remote_call
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     raise exc_type(*result[2])
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] oslo_concurrency.processutils.ProcessExecutionError: Unexpected error while running command.
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Command: mount -t nfs 192.168.1.50:/vol_cinder /var/lib/nova/mnt/724dab229d80c6a1a1e49a71c8356eed
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Exit code: 32
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Stdout: ''
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Stderr: 'Failed to connect to bus: No data available\nmount.nfs: Operation not permitted\n'
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] During handling of the above exception, another exception occurred:
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] Traceback (most recent call last):
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/compute/manager.py", line 7023, in _attach_volume
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     bdm.attach(context, instance, self.volume_api, self.driver,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/block_device.py", line 46, in wrapped
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     ret_val = method(obj, context, *args, **kwargs)
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/block_device.py", line 672, in attach
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     self._do_attach(context, instance, volume, volume_api,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/block_device.py", line 657, in _do_attach
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     self._volume_attach(context, volume, connector, instance,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/block_device.py", line 606, in _volume_attach
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     volume_api.attachment_delete(context,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 227, in __exit__
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     self.force_reraise()
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 200, in force_reraise
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     raise self.value
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/block_device.py", line 595, in _volume_attach
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     virt_driver.attach_volume(
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/driver.py", line 2052, in attach_volume
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     self._connect_volume(context, connection_info, instance,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/driver.py", line 1794, in _connect_volume
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     vol_driver.connect_volume(connection_info, instance)
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/volume/fs.py", line 113, in connect_volume
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     mount.mount(self.fstype, export, vol_name, mountpoint, instance,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/volume/mount.py", line 407, in mount
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     mount_state.mount(fstype, export, vol_name, mountpoint, instance,
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]   File "/usr/lib/python3.9/site-packages/nova/virt/libvirt/volume/mount.py", line 306, in mount
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177]     except processutils.ProcessExecutionError():
  2022-07-29 11:56:57.606 2 ERROR nova.compute.manager [instance: 6a9a59d1-861d-4536-84ed-e54d817f0177] TypeError: catching classes that do not inherit from BaseException is not allowed

  There's a piece of code in nova/virt/libvirt/volume/mount.py that is
  catching an instance of a class instead of a class [1]:

                  try:
                      nova.privsep.fs.mount(fstype, export, mountpoint, options)
                  except processutils.ProcessExecutionError():

  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('oops!')
  ... 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('oops!')
  ... 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

  [1]
  https://github.com/openstack/nova/blob/1220d53c2fd6231bb569a54f004a0e858536e970/nova/virt/libvirt/volume/mount.py#L309

  ===============
  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 backendand 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.ProcessExecutionError():

  TypeError: catching classes that do not inherit from BaseException is
  not allowed

  6) install updated package

  7) repeat step 4. It should attach successfully this time.

  [Regression Potential]

  The change is extremely trivial as a tiny python error. Absolutely
  zero regression potential.

  
  [Other Info]

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-archive/+bug/1984736/+subscriptions




More information about the Ubuntu-openstack-bugs mailing list