NSX|V3: Fix ipam to check subnets carefully

IPAM supports several types of subnets, and not all with the same attributes.
_is_supported_net should check if the subnet has a cidr before checking it, as
'any' subnet does not.

Change-Id: I7f567daf247233843b59ab932256e752ce62c309
This commit is contained in:
Adit Sarfaty 2019-01-10 14:15:17 +02:00
parent d7f6e0d2d2
commit 44df76021b

View File

@ -59,6 +59,8 @@ class Nsxv3IpamDriver(common.NsxAbstractIpamDriver):
def _is_supported_net(self, subnet_request):
"""This driver doesn't support multicast cidrs"""
if not hasattr(subnet_request, "subnet_cidr"):
return True
net = netaddr.IPNetwork(subnet_request.subnet_cidr[0])
return not net.is_multicast()