Comment 42 for bug 2030976

Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

this patch breaks cinder and potentially others when notifications are enabled.

https://codesearch.openstack.org/?q=def+_set_read_deleted&i=nope&literal=nope&files=context&excludeFiles=&repos=

the Context subclass in those projects has a property "read_deleted" that can not be None, only 'yes', 'no', or 'only'. But the safe_context is swallowing as it is not in 'safe list'. And fromDict in Cinder/Manila does not have default for it
https://opendev.org/openstack/cinder/src/commit/ddcf394ae277692d7cab2e03b4b6ae67ba7f1cc3/cinder/context.py#L193

so when it tries to create the class from dict it fails because it is passed None now.

2023-08-30T11:40:37.864665396Z 2023-08-30 11:40:37.864 1 ERROR cinder.scheduler.filter_scheduler [req-d940a4a6-f6fd-43f9-9ec6-f512168402b0 c298a2f40ba045de9bd4c675d3792920 dbe66253674c4173903b1c6eba4f9dd3 - - -] Error scheduling bde485dc-75ea-4c0a-bda9-e784676b4cdc from last vol-service: cinder-ceph-cluster@volumes-hdd#volumes-hdd : ['Traceback (most recent call last):\n', ' File "/var/lib/openstack/lib/python3.10/site-packages/taskflow/engines/action_engine/executor.py", line 53, in _execute_task\n result = task.execute(**arguments)\n', ' File "/var/lib/openstack/lib/python3.10/site-packages/cinder/volume/flows/manager/create_volume.py", line 371, in execute\n volume_utils.notify_about_volume_usage(context, volume,\n', ' File "/var/lib/openstack/lib/python3.10/site-packages/cinder/utils.py", line 960, in wrapped\n return f(*args, **kwargs)\n', ' File "/var/lib/openstack/lib/python3.10/site-packages/cinder/volume/volume_utils.py", line 177, in notify_about_volume_usage\n rpc.get_notifier("volume", host).info(context, \'volume.%s\' % event_suffix,\n', ' File "/var/lib/openstack/lib/python3.10/site-packages/oslo_messaging/notify/notifier.py", line 405, in info\n self._notify(ctxt, event_type, payload, \'INFO\')\n', ' File "/var/lib/openstack/lib/python3.10/site-packages/oslo_messaging/notify/notifier.py", line 494, in _notify\n super(_SubNotifier, self)._notify(ctxt, event_type, payload, priority)\n', ' File "/var/lib/openstack/lib/python3.10/site-packages/oslo_messaging/notify/notifier.py", line 344, in _notify\n safe_ctxt = _sanitize_context(ctxt)\n', ' File "/var/lib/openstack/lib/python3.10/site-packages/oslo_messaging/notify/notifier.py", line 212, in _sanitize_context\n return ctxt.__class__.from_dict(safe_dict)\n', ' File "/var/lib/openstack/lib/python3.10/site-packages/cinder/context.py", line 187, in from_dict\n return cls(user_id=values.get(\'user_id\'),\n', ' File "/var/lib/openstack/lib/python3.10/site-packages/cinder/context.py", line 115, in __init__\n self.read_deleted = read_deleted\n', ' File "/var/lib/openstack/lib/python3.10/site-packages/cinder/context.py", line 158, in _set_read_deleted\n raise ValueError(_("read_deleted can only be one of \'no\', "\n', "ValueError: read_deleted can only be one of 'no', 'yes' or 'only', not None\n"]

Seems like the real problem is that defaults in __init__ of cinder.context.RequestContext are different than when using fromDict

in __init__, read_deleted="no",
in dromDict, read_deleted=values.get("read_deleted") which is None that is even incompatible with itself.

the same seems to be relevant to Manila as well (and omni)

https://codesearch.openstack.org/?q=read_deleted%3Dvalues.get&i=nope&literal=nope&files=context&excludeFiles=&repos=