Description
===========
Three unit tests started failing on 1st July 2021 across python3.8 and python3.9 test jobs in manila, openstack/requirements and stable branch bitrot jobs:
==============================
Failed 3 tests - output below:
==============================
manila.tests.share.drivers.infinidat.test_infinidat.InfiniboxDriverTestCase.test__get_ip_address_range_single_ip
----------------------------------------------------------------------------------------------------------------
Captured traceback:
~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "/home/zuul/src/opendev.org/openstack/manila/manila/tests/share/drivers/infinidat/test_infinidat.py", line 281, in test__get_ip_address_range_single_ip
self.assertEqual('1.2.3.4', ip_address)
File "/home/zuul/src/opendev.org/openstack/manila/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 415, in assertEqual
self.assertThat(observed, matcher, message)
File "/home/zuul/src/opendev.org/openstack/manila/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 502, in assertThat
raise mismatch_error
testtools.matchers._impl.MismatchError: '1.2.3.4' != '1.2.3.4-1.2.3.4'
manila.tests.share.drivers.infinidat.test_infinidat.InfiniboxDriverTestCase.test_update_access
----------------------------------------------------------------------------------------------
Captured traceback:
~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "/home/zuul/src/opendev.org/openstack/manila/manila/tests/share/drivers/infinidat/test_infinidat.py", line 639, in test_update_access
self.assertEqual('1.2.3.4', permissions[0].client)
File "/home/zuul/src/opendev.org/openstack/manila/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 415, in assertEqual
self.assertThat(observed, matcher, message)
File "/home/zuul/src/opendev.org/openstack/manila/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 502, in assertThat
raise mismatch_error
testtools.matchers._impl.MismatchError: '1.2.3.4' != '1.2.3.4-1.2.3.4'
manila.tests.share.drivers.infinidat.test_infinidat.InfiniboxDriverTestCase.test_snapshot_update_access
-------------------------------------------------------------------------------------------------------
Captured traceback:
~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "/home/zuul/src/opendev.org/openstack/manila/manila/tests/share/drivers/infinidat/test_infinidat.py", line 726, in test_snapshot_update_access
self.assertEqual('1.2.3.4', permissions[0].client)
File "/home/zuul/src/opendev.org/openstack/manila/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 415, in assertEqual
self.assertThat(observed, matcher, message)
File "/home/zuul/src/opendev.org/openstack/manila/.tox/py38/lib/python3.8/site-packages/testtools/testcase.py", line 502, in assertThat
raise mismatch_error
testtools.matchers._impl.MismatchError: '1.2.3.4' != '1.2.3.4-1.2.3.4'
Steps to reproduce
==================
* Run "tox -epy3.9" (or 3.8) with the latest update of these python versions
* observed with python 3.8.11 and 3.9.6
Root Cause:
-----------
The code that's breaking is here: https://opendev.org/openstack/manila/src/commit/1beaf635791c56aafc6bf055e6a4d375197cd217/manila/share/drivers/infinidat/infinibox.py#L333-L334
The behavior of the ipaddress.ip_network.hosts() module seems to have changed in these versions. There is now a callout in the docs for /32 addresses:
"Networks with a mask of 32 will return a list containing the single host address."
https://docs.python.org/3.9/library/ipaddress.html#ipaddress.IPv4Network.hosts
This call out doesn't exist for python3.7 for instance:
https://docs.python.org/3.7/library/ipaddress.html#ipaddress.IPv4Network.hosts
Fix proposed to branch: master /review. opendev. org/c/openstack /manila/ +/799107
Review: https:/