From 1161a56a74b0fd926c20a63242af9dc852f56401 Mon Sep 17 00:00:00 2001 From: Goutham Pacha Ravi Date: Thu, 1 Jul 2021 09:01:55 -0700 Subject: [PATCH] Fix ipaddress issues in the infinidat driver In python3.8.11 and python3.9.6, the behavior of the ipaddress.ip_network.hosts() method changed. Now /32 addresses are returned by that method as a single element list. This was apparently done as a bugfix [1] Change-Id: Iab6d96351fa21131d834ccf07ffddd70555f25a7 Closes-Bug: #1934345 Signed-off-by: Goutham Pacha Ravi [1] https://bugs.python.org/issue27683 --- manila/share/drivers/infinidat/infinibox.py | 2 +- ...345-fix-ipaddress-hosts-invocation-80d419d7e62a5f51.yaml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/bug-1934345-fix-ipaddress-hosts-invocation-80d419d7e62a5f51.yaml diff --git a/manila/share/drivers/infinidat/infinibox.py b/manila/share/drivers/infinidat/infinibox.py index 6f8aa475d4..2014b26873 100644 --- a/manila/share/drivers/infinidat/infinibox.py +++ b/manila/share/drivers/infinidat/infinibox.py @@ -330,7 +330,7 @@ class InfiniboxShareDriver(driver.ShareDriver): # try treating the ip_address parameter as a range of IP addresses: ip_network = ipaddress.ip_network(ip_address, strict=False) ip_network_hosts = list(ip_network.hosts()) - if len(ip_network_hosts) == 0: # /32, single IP address + if len(ip_network_hosts) < 2: # /32, single IP address return ip_address.split('/')[0] return "{}-{}".format(ip_network_hosts[0], ip_network_hosts[-1]) diff --git a/releasenotes/notes/bug-1934345-fix-ipaddress-hosts-invocation-80d419d7e62a5f51.yaml b/releasenotes/notes/bug-1934345-fix-ipaddress-hosts-invocation-80d419d7e62a5f51.yaml new file mode 100644 index 0000000000..381807ad8f --- /dev/null +++ b/releasenotes/notes/bug-1934345-fix-ipaddress-hosts-invocation-80d419d7e62a5f51.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + The Infinidat driver's been fixed to process single IP Addresses (/32) + correctly. See `bug 1934345 `_ for + more details.