From c33810b865324ad433fbcd9a89fbbf9f75ee32f1 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Sun, 12 Mar 2017 01:20:14 -0800 Subject: [PATCH] NSX|V: add in exclusive DHCP support Via the configuration variable exclusive_dhcp_edge enable a tenant to create a exclusive DHCP edge. This can be global or via AZ. DocImpact Change-Id: Ia5220302114d73fa89b3f3ea86141cb3208fe885 --- .../notes/nsxv-exclusive-dhcp-7e5cde1cd88f8c5b.yaml | 8 ++++++++ vmware_nsx/common/config.py | 6 ++++++ vmware_nsx/plugins/nsx_v/availability_zones.py | 4 ++++ vmware_nsx/plugins/nsx_v/vshield/edge_utils.py | 6 ++++-- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/nsxv-exclusive-dhcp-7e5cde1cd88f8c5b.yaml diff --git a/releasenotes/notes/nsxv-exclusive-dhcp-7e5cde1cd88f8c5b.yaml b/releasenotes/notes/nsxv-exclusive-dhcp-7e5cde1cd88f8c5b.yaml new file mode 100644 index 0000000000..63e09ac0be --- /dev/null +++ b/releasenotes/notes/nsxv-exclusive-dhcp-7e5cde1cd88f8c5b.yaml @@ -0,0 +1,8 @@ +--- +prelude: > + Add support for exclusive DHCP edges. +features: + - | + The NSX-v will now enable a tenant to deploy a exclusive DHCP edge. This + is either via the global configuration variable ``exclusive_dhcp_edge`` or + per AZ. By default this is disabled. diff --git a/vmware_nsx/common/config.py b/vmware_nsx/common/config.py index df06361605..e4dae9ce8e 100644 --- a/vmware_nsx/common/config.py +++ b/vmware_nsx/common/config.py @@ -663,6 +663,9 @@ nsxv_opts = [ "connectivity between hosts on same network via " "their floating ips. If True, floating ip will " "be associated with all router interfaces.")), + cfg.BoolOpt('exclusive_dhcp_edge', + default=False, + help=_("(Optional) Have exclusive DHCP edge per network.")), ] # define the configuration of each availability zone. @@ -718,6 +721,9 @@ nsxv_az_opts = [ cfg.StrOpt('dvs_id', help=_('(Optional) DVS MoRef ID for DVS connected to ' 'Management / Edge cluster')), + cfg.BoolOpt('exclusive_dhcp_edge', + default=False, + help=_("(Optional) Have exclusive DHCP edge per network.")), ] # Register the configuration options diff --git a/vmware_nsx/plugins/nsx_v/availability_zones.py b/vmware_nsx/plugins/nsx_v/availability_zones.py index 316aa6daf8..74047329ea 100644 --- a/vmware_nsx/plugins/nsx_v/availability_zones.py +++ b/vmware_nsx/plugins/nsx_v/availability_zones.py @@ -65,6 +65,7 @@ class NsxVAvailabilityZone(common_az.ConfiguredAvailabilityZone): self.vdn_scope_id = cfg.CONF.nsxv.vdn_scope_id self.dvs_id = cfg.CONF.nsxv.dvs_id self.edge_host_groups = cfg.CONF.nsxv.edge_host_groups + self.exclusive_dhcp_edge = cfg.CONF.nsxv.exclusive_dhcp_edge # No support for metadata per az self.az_metadata_support = False @@ -121,6 +122,8 @@ class NsxVAvailabilityZone(common_az.ConfiguredAvailabilityZone): if not self.edge_host_groups: self.edge_host_groups = cfg.CONF.nsxv.edge_host_groups + self.exclusive_dhcp_edge = az_info.get('exclusive_dhcp_edge', False) + # Support for metadata per az only if configured, and different # from the global one self.mgt_net_proxy_ips = az_info.get('mgt_net_proxy_ips') @@ -178,6 +181,7 @@ class NsxVAvailabilityZone(common_az.ConfiguredAvailabilityZone): self.vdn_scope_id = cfg.CONF.nsxv.vdn_scope_id self.dvs_id = cfg.CONF.nsxv.dvs_id self.edge_host_groups = cfg.CONF.nsxv.edge_host_groups + self.exclusive_dhcp_edge = cfg.CONF.nsxv.exclusive_dhcp_edge def supports_metadata(self): # Return True if this az has it's own metadata configuration diff --git a/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py b/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py index 30d5600d2b..e5a6ef47b4 100644 --- a/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py +++ b/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py @@ -1123,8 +1123,10 @@ class EdgeManager(object): free_number = ((vcns_const.MAX_VNIC_NUM - 1) * vcns_const.MAX_TUNNEL_NUM - len(edge_vnic_bindings)) - # metadata internal network will use one vnic - if free_number <= (vcns_const.MAX_TUNNEL_NUM - 1): + # metadata internal network will use one vnic or + # exclusive_dhcp_edge is set for the AZ + if (free_number <= (vcns_const.MAX_TUNNEL_NUM - 1) or + availability_zone.exclusive_dhcp_edge): conflict_edge_ids.append(dhcp_edge_id) for net_id in conflicting_nets: