NSX|P: Fix ipv6 subnet gateway IP
Since NSX 3.0 ipv6 subnet GW cannot have a zero suffix. This fix performs the check & update for MP DHCP subnets, in addition to the Policy DHCP subnets that already had this check. Change-Id: Ie74e96eb36df16f5e98588d92067f94168f3f5a6
This commit is contained in:
@@ -1288,8 +1288,11 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
|
|||||||
def _init_ipv6_gateway(self, subnet):
|
def _init_ipv6_gateway(self, subnet):
|
||||||
# Override neutron decision to verify that also for ipv6 the first
|
# Override neutron decision to verify that also for ipv6 the first
|
||||||
# ip in the cidr is not used, as the NSX does not support xxxx::0 as a
|
# ip in the cidr is not used, as the NSX does not support xxxx::0 as a
|
||||||
# segment subnet gateway.
|
# segment subnet gateway in versions supporting policy DHCP
|
||||||
if (subnet.get('gateway_ip') is const.ATTR_NOT_SPECIFIED and
|
|
||||||
|
if (self.nsxpolicy.feature_supported(
|
||||||
|
nsxlib_consts.FEATURE_NSX_POLICY_DHCP) and
|
||||||
|
subnet.get('gateway_ip') is const.ATTR_NOT_SPECIFIED and
|
||||||
subnet.get('ip_version') == const.IP_VERSION_6 and
|
subnet.get('ip_version') == const.IP_VERSION_6 and
|
||||||
subnet.get('cidr') and subnet['cidr'] != const.ATTR_NOT_SPECIFIED):
|
subnet.get('cidr') and subnet['cidr'] != const.ATTR_NOT_SPECIFIED):
|
||||||
net = netaddr.IPNetwork(subnet['cidr'])
|
net = netaddr.IPNetwork(subnet['cidr'])
|
||||||
@@ -1325,6 +1328,7 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
|
|||||||
|
|
||||||
@nsx_plugin_common.api_replay_mode_wrapper
|
@nsx_plugin_common.api_replay_mode_wrapper
|
||||||
def create_subnet(self, context, subnet):
|
def create_subnet(self, context, subnet):
|
||||||
|
self._init_ipv6_gateway(subnet['subnet'])
|
||||||
if not self.use_policy_dhcp:
|
if not self.use_policy_dhcp:
|
||||||
# Subnet with MP DHCP
|
# Subnet with MP DHCP
|
||||||
return self._create_subnet_with_mp_dhcp(context, subnet)
|
return self._create_subnet_with_mp_dhcp(context, subnet)
|
||||||
@@ -1333,7 +1337,6 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
|
|||||||
net_id = subnet['subnet']['network_id']
|
net_id = subnet['subnet']['network_id']
|
||||||
network = self._get_network(context, net_id)
|
network = self._get_network(context, net_id)
|
||||||
self._validate_single_ipv6_subnet(context, network, subnet['subnet'])
|
self._validate_single_ipv6_subnet(context, network, subnet['subnet'])
|
||||||
self._init_ipv6_gateway(subnet['subnet'])
|
|
||||||
net_az = self.get_network_az_by_net_id(context, net_id)
|
net_az = self.get_network_az_by_net_id(context, net_id)
|
||||||
|
|
||||||
# Allow manipulation of only 1 subnet of the same network at once
|
# Allow manipulation of only 1 subnet of the same network at once
|
||||||
|
Reference in New Issue
Block a user