Fix Ceph Squid Module Loading - v1
==================================

The first patch provides a workaround for the PyO3 ImportError that's
being thrown by the `restful` Ceph mgr Python module upon import.
This fixes the following error:

    2025-07-16T17:40:40.932+0200 7c315bc77080  1 mgr[py] Loading python module 
'restful'
    2025-07-16T17:40:41.220+0200 7c315bc77080 -1 mgr[py] Module not found: 
'restful'
    2025-07-16T17:40:41.220+0200 7c315bc77080 -1 mgr[py] Traceback (most recent 
call last):
      File "/usr/share/ceph/mgr/restful/__init__.py", line 1, in <module>
        from .module import Module
      File "/usr/share/ceph/mgr/restful/module.py", line 22, in <module>
        from OpenSSL import crypto
      File "/lib/python3/dist-packages/OpenSSL/__init__.py", line 8, in <module>
        from OpenSSL import SSL, crypto
      File "/lib/python3/dist-packages/OpenSSL/SSL.py", line 15, in <module>
        from cryptography import x509
      File "/lib/python3/dist-packages/cryptography/x509/__init__.py", line 7, 
in <module>
        from cryptography.x509 import certificate_transparency, verification
      File 
"/lib/python3/dist-packages/cryptography/x509/certificate_transparency.py", 
line 11, in <module>
        from cryptography.hazmat.bindings._rust import x509 as rust_x509
    ImportError: PyO3 modules compiled for CPython 3.8 or older may only be 
initialized once per interpreter process

    2025-07-16T17:40:41.222+0200 7c315bc77080 -1 mgr[py] Class not found in 
module 'restful'
    2025-07-16T17:40:41.222+0200 7c315bc77080 -1 mgr[py] Error loading module 
'restful': (2) No such file or directory


The second patch fixes how the Ceph mgr looks up the NOTIFY_TYPES
attribute of the mgr Python modules' classes. This also happens to fix
the `mgr_module` Python module import failure. In total, this fixes
errors like the following:

    2025-07-16T17:40:41.222+0200 7c315bc77080  1 mgr[py] Loading python module 
'selftest'
    2025-07-16T17:40:41.377+0200 7c315bc77080 -1 mgr[py] Module selftest has 
missing NOTIFY_TYPES member
    2025-07-16T17:40:41.377+0200 7c315bc77080 -1 mgr[py] Module not found: 
'mgr_module'
    2025-07-16T17:40:41.377+0200 7c315bc77080 -1 mgr[py] AttributeError: type 
object 'Module' has no attribute 'NOTIFY_TYPES'
    
    2025-07-16T17:40:41.377+0200 7c315bc77080  1 mgr[py] Loading python module 
'snap_schedule'
    2025-07-16T17:40:41.497+0200 7c315bc77080 -1 mgr[py] Module snap_schedule 
has missing NOTIFY_TYPES member
    2025-07-16T17:40:41.497+0200 7c315bc77080 -1 mgr[py] Module not found: 
'mgr_module'
    2025-07-16T17:40:41.497+0200 7c315bc77080 -1 mgr[py] AttributeError: type 
object 'Module' has no attribute 'NOTIFY_TYPES'
    
    2025-07-16T17:40:41.497+0200 7c315bc77080  1 mgr[py] Loading python module 
'stats'
    2025-07-16T17:40:41.636+0200 7c315bc77080  1 mgr[py] Loading python module 
'status'
    2025-07-16T17:40:41.785+0200 7c315bc77080 -1 mgr[py] Module status has 
missing NOTIFY_TYPES member
    2025-07-16T17:40:41.785+0200 7c315bc77080 -1 mgr[py] Module not found: 
'mgr_module'
    2025-07-16T17:40:41.785+0200 7c315bc77080 -1 mgr[py] AttributeError: type 
object 'Module' has no attribute 'NOTIFY_TYPES'

Note: These logs can be found inside the ceph-mgr logs in the
/var/log/ceph directory.

The commit messages of the supplied patches elaborate on further
details.

Summary of Changes
------------------

Max R. Carrara (2):
  provide workaround for PyO3 ImportError
  mgr: fix errors regarding module imports and NOTIFY_TYPES attributes

 ...ul-provide-workaround-for-PyO3-Impor.patch | 152 ++++++++++++++++++
 ...mport-by-making-NOTIFY_TYPES-in-py-m.patch |  56 +++++++
 patches/series                                |   2 +
 3 files changed, 210 insertions(+)
 create mode 100644 
patches/0058-pybind-mgr-restful-provide-workaround-for-PyO3-Impor.patch
 create mode 100644 
patches/0059-mgr-fix-module-import-by-making-NOTIFY_TYPES-in-py-m.patch

-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to