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 ~~~
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
Latest upstream news about removal of this driver: http://lists.openstack.org/pipermail/openstack-discuss/2020-June/015692.html
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