Bug 1848420 - Brocade Fibre Channel Zone Manager driver does not support python 3
Summary: Brocade Fibre Channel Zone Manager driver does not support python 3
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-cinder
Version: 16.0 (Train)
Hardware: x86_64
OS: Linux
high
high
Target Milestone: z2
: 16.1 (Train on RHEL 8.2)
Assignee: Gorka Eguileor
QA Contact: Tzach Shefi
Andy Stillman
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-18 10:58 UTC by Sergii Mykhailushko
Modified: 2023-10-06 20:42 UTC (History)
11 users (show)

Fixed In Version: openstack-cinder-15.3.1-1.20200914173114.00ac80b.el8ost
Doc Type: Bug Fix
Doc Text:
This update makes it possible to run the Brocade FCZM driver in RHOSP 16. + The Brocade FCZM vendor chose not to update the driver for Python 3, and discontinued support of the driver past the Train release of OpenStack [1]. Red Hat OpenStack (RHOSP) 16 uses Python 3.6. + The upstream Cinder community assumed the maintenance of the Brocade FCZM driver on a best-effort basis, and the bugs that prevented the Brocade FCZM from running in a Python 3 environment (and hence in RHOSP 16) have been fixed. + [1] https://docs.broadcom.com/doc/12397527
Clone Of:
Environment:
Last Closed: 2020-10-28 15:45:55 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 742489 0 None MERGED Brocade: Python 3 support 2020-10-19 15:27:55 UTC
OpenStack gerrit 742490 0 None MERGED Brocade: Fix AttributeError when raising exception 2020-10-19 15:27:55 UTC
OpenStack gerrit 742491 0 None MERGED Brocade: Fix lookup UnboundLocalError 2020-10-19 15:27:54 UTC
Red Hat Product Errata RHSA-2020:4283 0 None None None 2020-10-28 15:46:43 UTC

Description Sergii Mykhailushko 2020-06-18 10:58:38 UTC
Description of problem:

Hi all,

Seems we need to fix some parts on Brocade FC driver after RHOSP 16 was rebased to RHEL 8 (and thus Python 3). The below error is raised when trying to attach a volume to an instance:

~~~
2020-06-15 21:11:46.907 129 INFO cinder.zonemanager.drivers.brocade.brcd_rest_fc_zone_client [req-49af2a3b-a31a-4a87-8bee-d9ba262764c0 7bc4473b43ef45dbbd70da0755e47959 1fc8348718564464a3fd56b321d88634 - default default] REST logout success
2020-06-15 21:11:46.908 129 INFO cinder.zonemanager.drivers.brocade.brcd_fc_zone_driver [req-49af2a3b-a31a-4a87-8bee-d9ba262764c0 7bc4473b43ef45dbbd70da0755e47959 1fc8348718564464a3fd56b321d88634 - default default] Filtered targets for SAN
 is: <filter object at 0x7effa1bac710>
2020-06-15 21:11:46.908 129 ERROR cinder.zonemanager.fc_zone_manager [req-49af2a3b-a31a-4a87-8bee-d9ba262764c0 7bc4473b43ef45dbbd70da0755e47959 1fc8348718564464a3fd56b321d88634 - default default] Failed adding connection for fabric=None: E
rror: 'filter' object is not subscriptable
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager [req-49af2a3b-a31a-4a87-8bee-d9ba262764c0 7bc4473b43ef45dbbd70da0755e47959 1fc8348718564464a3fd56b321d88634 - default default] Driver initialize connection failed (error: Fibre Channe
l connection control failure: Failed adding connection for fabric=None: Error: 'filter' object is not subscriptable).: cinder.exception.ZoneManagerException: Fibre Channel connection control failure: Failed adding connection for fabric=Non
e: Error: 'filter' object is not subscriptable
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager Traceback (most recent call last):
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager   File "/usr/lib/python3.6/site-packages/cinder/zonemanager/fc_zone_manager.py", line 223, in add_connection
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager     fabric_map = self.get_san_context(target_list)
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager   File "/usr/lib/python3.6/site-packages/cinder/zonemanager/fc_zone_manager.py", line 335, in get_san_context
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager     fabric_map = self.driver.get_san_context(target_wwn_list)
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager   File "/usr/lib/python3.6/site-packages/cinder/zonemanager/drivers/brocade/brcd_fc_zone_driver.py", line 450, in get_san_context
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager     visible_targets[idx]).replace(':', '')
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager TypeError: 'filter' object is not subscriptable
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager 
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager During handling of the above exception, another exception occurred:
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager 
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager Traceback (most recent call last):
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager   File "/usr/lib/python3.6/site-packages/cinder/volume/manager.py", line 4490, in _connection_create
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager     conn_info = self.driver.initialize_connection(volume, connector)
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager   File "/usr/lib/python3.6/site-packages/cinder/volume/drivers/pure.py", line 175, in wrapper
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager     result = f(*args, **kwargs)
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager   File "/usr/lib/python3.6/site-packages/cinder/volume/drivers/pure.py", line 2659, in initialize_connection
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager     fczm_utils.add_fc_zone(properties)
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager   File "/usr/lib/python3.6/site-packages/cinder/zonemanager/utils.py", line 86, in add_fc_zone
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager     zm.add_connection(connection_info)
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager   File "/usr/lib/python3.6/site-packages/cinder/zonemanager/fc_zone_manager.py", line 248, in add_connection
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager     raise exception.ZoneManagerException(reason=msg)
2020-06-15 21:11:46.908 129 ERROR cinder.volume.manager cinder.exception.ZoneManagerException: Fibre Channel connection control failure: Failed adding connection for fabric=None: Error: 'filter' object is not subscriptable
~~~

It looks like the code is expecting filter() to return a list. While it was fine with Python 2, since version 3 the iterations are returned, as described here:

https://docs.python.org/3.0/whatsnew/3.0.html#views-and-iterators-instead-of-lists

---8<---
Some well-known APIs no longer return lists:

- dict methods dict.keys(), dict.items() and dict.values() return “views” instead of lists. For example, this no longer works: k = d.keys(); k.sort(). Use k = sorted(d) instead (this works in Python 2.5 too and is just as efficient).
- Also, the dict.iterkeys(), dict.iteritems() and dict.itervalues() methods are no longer supported.
--> - map() and filter() return iterators. If you really need a list, a quick fix is e.g. list(map(...)), but a better fix is often to use a list comprehension (especially when the original code uses lambda), or rewriting the code so it doesn’t need a list at all. Particularly tricky is map() invoked for the side effects of the function; the correct transformation is to use a regular for loop (since creating a list would just be wasteful).
- range() now behaves like xrange() used to behave, except it works with values of arbitrary size. The latter no longer exists.
- zip() now returns an iterator.
--->8---


Version-Release number of selected component (if applicable):

python3-cinder-15.0.2-0.20200123220928.900f769.el8ost.noarch.rpm:

~~~
rpm -qlp ./python3-cinder-15.0.2-0.20200123220928.900f769.el8ost.noarch.rpm  | egrep "fc_zone_manager.py|brcd_fc_zone_driver.py"

/usr/lib/python3.6/site-packages/cinder/zonemanager/drivers/brocade/brcd_fc_zone_driver.py
/usr/lib/python3.6/site-packages/cinder/zonemanager/fc_zone_manager.py
~~~

Comment 2 Luigi Toscano 2020-06-19 10:03:31 UTC
An quick note about that code for reference: Brocade supports it only with Python 2, and the driver itself has been deprecated upstream and it will be removed in the next version: https://docs.broadcom.com/doc/12397527

Comment 4 Brian Rosmaita 2020-06-29 13:04:08 UTC
Latest upstream news about removal of this driver: http://lists.openstack.org/pipermail/openstack-discuss/2020-June/015692.html

Comment 29 errata-xmlrpc 2020-10-28 15:45:55 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 (Moderate: openstack-cinder security update), 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/RHSA-2020:4283


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