Commit Graph

2278 Commits

Author SHA1 Message Date
Salvatore Orlando 52a975fffe Cleanup port: perform backend operation before DB operation
Invert the order of operation in order to ensure DB entry is not
removed is operations fails in unexpected way

Change-Id: I77c1a48ac59ab577ed284d40e2a90fc44fe32b10
2021-11-28 10:22:59 -08:00
Zuul ca624d95fb Merge "Retry DHCP server deletion" 2021-11-19 15:01:26 +00:00
Zuul 86a27b2f62 Merge "[NSX-P] Improve port deletion handling" 2021-11-19 15:01:23 +00:00
Salvatore Orlando d6922a5d80 Retry DHCP server deletion
In some cases deletion might fail because a segment port
is still reported as attached.

This change will ensure the operation is retried so it
eventually succeeds.

Change-Id: Ic40f8162f127414653ebeebca4cae5481b01585f
2021-11-19 04:11:10 -08:00
Salvatore Orlando c941dba414 [NSX-P] Improve port deletion handling
During port deletion on the backend, we remove profile bindings and
then the actual port. If for any reason a binding is not found, the
process should still proceed to delete remaining resources up to
the segment port.

This change fixes this behaviour, as the code was instead returning
as soon an object was not found.

Change-Id: I529ce34db323f900129865befc6bd64e1ff4f5ff
2021-10-27 13:24:13 -07:00
Salvatore Orlando e70cf0e5d1 Improve security group rule add performance and reliability
This change leverages a new NSX client method, patch_entries.
This method does not require all rules to be in the request body.
We can therefore save a DB operation, and submit a much smaller
payload. NSX responses are also much faster.

In addition, this routine ensure the DB record for a security
group rule is removed if the creation of the same rule fails at
the NSX backend.

Change-Id: I5c97c3042f8f740cac211314e11ce01e03beaa7e
2021-10-25 13:21:00 -07:00
Zuul 21a0d31bac Merge "[NSX-P] Ensure multicast is disabled for dualstack use cases" 2021-10-18 18:23:11 +00:00
Salvatore Orlando 31bd496e31 [NSX-P/NSX-v3] Metadata route: make windows route optional
Introduce a new configuration option - windows_metadata_route.
Specifies whether an explicit route for metadata proxy access
on windows should be added.

The default value will be True for backward compatibility.
This option will need to be set to False for some guest OSes such
as RHEL8 as a duplicate metadata route can cause failures while
setting up networking.

Change-Id: If7507d0d4242cce2c73c7a2239149ec35fef232f
2021-10-18 09:33:54 -07:00
Salvatore Orlando 819c74ef30 Replace occurrences of registry.notify
This change replaces remaining occurences of the notify method with
calls to the publish method.
As NSX admin utilities heavily rely on callbacks, this change also
ensures that all callbacks are now accepting event payloads rather
thank kwargs.

Change-Id: I0450fff486898d6ab74086b7952dc27134cb77e2
2021-10-18 03:24:34 -07:00
Salvatore Orlando 5c7c09d56a [NSX-P] Ensure multicast is disabled for dualstack use cases
For some dual-stack use cases it will be mandatory to disable multicast
routing on NSX-T segments.

Change-Id: I821b6038ec4b0404d54c03c8802bdbbf8d211ed4
2021-10-14 13:53:33 -07:00
Kobi Samoray 8031a85420 NSXV: validate metadata config for AZs
When an AZ is configured with a non-default DVS id, it must have a
metadata configuration as well.
The minimum required is the metadata edge IPs.

Change-Id: Iebbbf6e73975c67876a925a4d54a6a263c4da10f
2021-10-10 17:50:35 +03:00
Salvatore Orlando d055dec0fa [NSX-P] Don't cache empty logical switch id for segment
If a NSX-T segment is not realized, the plugin will currently
return a null value for the corresponding logical switch id.
This leads nova to boot VMs with an incorrect network attachment.

This change ensures the null value is not cached for the neutron
network.

Change-Id: I7ef3fc8e13777e5fcdc53bd84d5dc235f7e8686c
2021-10-07 07:34:47 -07:00
Salvatore Orlando 5365416398 [NSX-P|v3] Avoid trivial errors in address binding handling
If the multiple address bindings fall in the same CIDR, we should be
careful in verifying that the corresponding entry has not already
been removed from the binding list

Change-Id: I4e8ace9c3a4f6a09246038fec09d3040b8b93e74
2021-09-29 13:16:15 -07:00
Salvatore Orlando 1e346e9c8e Adapt check for restricted VLAN
Due to removal of deprecated attributes from NSX APIs, the routine
for checking VLAN overlap with uplink transport needs to be amended
to search for transport zone in host switch info.

This change also optimizes the process by avoiding fetching the same
profile multiple times.

Change-Id: I3af3c0f2bef1041c18c1b9d84aaa5ca7bd7638bf
2021-09-22 10:12:40 -07:00
Salvatore Orlando b140182816 Do not set multicast=True if not needed
In some cases - such as isolated segments - multicast cannot
be enabled. Leaving it to default settings will avoid error
responses from the NSX-T backend.

Change-Id: I65beefc574f0167e9679c873c99e48173999741c
2021-09-06 09:49:57 -07:00
Zuul 586a98bf4e Merge "NSXV status for out of sync LBs" 2021-09-05 09:41:17 +00:00
Zuul 83d59be2c8 Merge "[NSX-P] Ensure multicast setting is specified in all cases" 2021-08-27 12:17:00 +00:00
Salvatore Orlando 8b7c163cb9 [NSX-P] Ensure multicast setting is specified in all cases
Every time a segment is updated with subnet, we need to explicitly
set the multicast setting to ensure it is disabled when only an
IPv6 subnet is present on the segment.

Change-Id: Ie75c87ac56f7d690c1dd6453001affcc7b1a035a
2021-08-27 01:14:48 -07:00
Zuul ebe51d04e3 Merge "[NSX-P] Disable/enable multicast on segment" 2021-08-26 22:29:19 +00:00
Salvatore Orlando 5f6b4a58d9 [NSX-P] Disable/enable multicast on segment
When updating a segment, disable multicast if there is only
a v6 subnet configured on it.

Change-Id: Ia5043a9165e208570d566b6510fa1c35f0663cd2
2021-08-26 14:08:40 -07:00
Kobi Samoray fb6fc96afc NSXV status for out of sync LBs
When a LB exists in Octavia DB, but missing in NSX, its status is never
updated.
The following addresses this condition by collecting the LBs from
Octavia and validating them periodically.

Change-Id: I3c42a934a47532968c65aaeade8210364167f35a
2021-08-25 12:25:35 +00:00
Salvatore Orlando 60a7ede0f9 Remove check for external CIDR overlap
The constrains where T0 uplinks must not overlap anymore
with external subnets does not apply anymore.

Therefore this change removes the validation check upon subnet
creation, thus saving a round trip to the NSX backend.

Unit tests for validating this specific constraint are removed as
well.

Change-Id: I65cb6ae7822e9a03f05fba5d4fd4d4dc5202526a
2021-08-24 09:43:38 -07:00
Salvatore Orlando 214513d726 Use Ids for predefined NSX switching profiles
As these profiles have hardcoded Ids, it is much safer and efficient
to use directly the resource Ids rather than fetching resources by
name.

Change-Id: Iba462a1fe1209f5e31be93eef3ecd450e16a5138
2021-08-23 09:23:42 -07:00
Salvatore Orlando 31c2b87b9a NSX-v3: Fix add router interface for VLAN downlinks
In NSX, a service router is required when attaching a VLAN interface
to a router.
This change ensures the service router is set before attaching the
interface. This allow for the interface to be attached even before
setting a gateway for the router.

Change-Id: Ia070aed9c97f3c87615b9c7e0b084f2edb26e0a9
2021-07-19 06:37:24 -07:00
Kobi Samoray 1316d7e43a NSXV: ensure default SG
Ensure default security group during port and SG creation

Change-Id: Ie0a46e08f603eb3647952ed7d2dbd76cc436601f
2021-07-13 11:39:37 +03:00
Salvatore Orlando b792a8ce77 V2T: Ensure transit LS is created for routers on Policy
This will simplify the N/S cutover process, allowing it to run
smoothly also for routers with no downlink interfaces

Change-Id: Ida4f2ba787c5bb897b6d2f479b32f715b1e83713
2021-07-09 01:59:49 -07:00
Salvatore Orlando 73bf4bbe31 NSX-P+v3: Better handling for NSX address bindings
When allowed address pairs are specified they can overlap with
fixed IPs, especially when they specify CIDRs.
The plugin should not fail to create/update neutron ports in this
case, but should instead properly handle NSX address bindings.

Change-Id: I145950ebe5769490f1c05729d94869dfa2e7d856
2021-07-07 15:36:38 -07:00
Kobi Samoray e28f9c13fb Fix pep8 issues
Change-Id: I673536bdb0d769de7e5e8f3e0dd315d81c6d23fe
2021-07-01 15:11:33 +03:00
Kobi Samoray f54c9cf148 Adapt SG payload implementation
Change-Id: Icdce873757ecbce3f9c2eaa9ccfc2f4f8a22d124
2021-06-29 10:54:39 +03:00
Salvatore Orlando fe0e3089cb [NSX-P] Relax IP validation for DHCP and v6 subnets
Extend validation relaxation introduced by commit 607afed94, by
allowing for multiple IPs for a given port also on DHCP and IPv6
subnets.

In order to ensure correct processing of DHCP bindings, the
process a binding is created only for the first IP address
allocated in the subnet; the process also ensures that the
address associated with the DHCP binding does not change unless
removed from the port's fixed_ips.

This change applies only to the nsx_p plugin, and the other
constraints on port IP allocation are still in place.

Change-Id: I0271b9be8e73e8e6b9d1b3b51bebc1542efd3d29
2021-06-22 01:38:59 -07:00
Salvatore Orlando a9a8bfa13b NSX-V: Fail only if DHCP enabled when updating external subnet
The current logic is forbidding all sort of updates on subnets
associated with external networks.

Change-Id: I89f3ef821534f26b820790b48ba385889498ff46
2021-06-16 01:13:44 -07:00
Kobi Samoray e7315ff3ba Import no-lock quota driver in V3 plugins
Change-Id: I14463793c4a3434fceb52e1c004d817dd754ef14
2021-06-14 12:30:17 +00:00
Zuul 6597b37035 Merge "NSXV: fail attachment of VDRs to flat networks" 2021-06-07 11:11:32 +00:00
Kobi Samoray 9c189e303b NSXV: retrieve DNS IPs from subnet correctly
subnet['dns_nameservers'] is a list of strings, not dictionaries.

Change-Id: I929f5ab4d1eb3d538b9e50d08d13554575eab99b
2021-06-02 08:28:13 +00:00
Kobi Samoray 867b96eb81 NSXP: port deletion in designate
When a Neutron port is deleted, the DNS entry in Designate should be
deleted as well.
This is done by triggering a BEFORE_DELETE event in delete_port()

Change-Id: I341824b813bed11de2428238a0952626d1edb02e
2021-05-28 19:40:28 +03:00
Kobi Samoray 9e0db6030e NSXV: fail attachment of VDRs to flat networks
NSXV distributed routers cannot be attached to flat networks. Yet
OpenStack should fail with an error instead of letting the backend
transaction fail.

Change-Id: If2f0c4c47d049ec37348d6cea32f0bb069a0c9b2
2021-05-13 19:26:52 +03:00
Zuul 8b6611d4ca Merge "Relax IPAM validation for port IPs" 2021-05-10 18:12:00 +00:00
Salvatore Orlando 607afed94d Relax IPAM validation for port IPs
Allow for setting multiple IPs from the same subnet, only if
the subnet is v4 and DHCP is disabled for the subnet.

Still make sure at most 1 IPv4 and 1 IPv6 subnet can be
configured.

Change-Id: I1113a24fa8cc09892bc89917d50c64f6a72c0dab
2021-05-07 15:32:59 +00:00
Zuul 8947b35ee7 Merge "Validate transport zone type upon neutron startup" 2021-05-04 19:56:06 +00:00
Anna Khmelnitsky f5cdef72a6 Validate transport zone type upon neutron startup
Upon startup, the plugin validates that configured default tzs
exist on backend, however does not validate their type. This
change adds type validation (OVERLAY or VLAN), and throws startup
exception if type is incorrect.
In addition, this change adds null validation and removes dead
code.

Change-Id: Ibeff164eb03fec9141326c24b0c069f0e16a1e7b
2021-04-28 23:59:48 +00:00
Zuul 07034fcfc1 Merge "NSXV: handle missing SG mapping" 2021-04-28 13:22:34 +00:00
Zuul a36c11a833 Merge "NSXV: Handle requests ConnectionError exception" 2021-04-28 09:13:47 +00:00
Kobi Samoray fe0264d35a NSXV: handle missing SG mapping
When creating rules, the plugin fetches the SG mapping from Neutron DB.
If this mapping is missing, the plugin should issue a proper error and
fail.

Change-Id: Icd00116dc6e81949513db18f16eced8a2b125c7d
2021-04-28 08:59:17 +00:00
Salvatore Orlando 201e39868e [NSX-P] Relax network update provider attribute validation
Allow updates in physical network id for network of type l3_ext
in order to allow for re-wiring an external network to a different
NSX Tier-0 GW router.

Change-Id: I1e3dc1ed874c78d9db43a31ddf29f413e530a808
2021-04-22 11:10:03 -07:00
Zuul 1d6fbdf15b Merge "NSXV: protect against stale LB bindings" 2021-04-19 14:22:53 +00:00
Kobi Samoray 9f53623d2f NSXV: Handle requests ConnectionError exception
DNS failures cause requests module to raise a ConnectionError exception.
We should issue a retry upon this exception as DNS erros within a
network are normal.

Change-Id: Id543a55fbd7002f839981ba47909546ef229f5f9
2021-04-19 13:27:24 +00:00
Zuul 3104b16023 Merge "NSXV: Elevate context for router firewall update" 2021-04-19 13:10:03 +00:00
Zuul 5f9a4fa591 Merge "Ensure DB quota driver is loaded early for NSX plugins" 2021-04-19 12:18:37 +00:00
Salvatore Orlando 7d1d09187f Ensure DB quota driver is loaded early for NSX plugins
This will avoid the ConfDriver being accidentally loaded.

Change-Id: Idb508edfa9087f61404b7a14d3327d91caa79e35
2021-04-19 02:40:17 -07:00
Salvatore Orlando 4c051558e0 [NSX-P] Ensure DHCP binding are always deleted from backend
Perform operations to check if network has DHCP enabled in elevated
context. In this way info will always be retrieved even if the port
delete operation is performed in a context different than the one
of the network owner.

Also adding unit test to validate the scenario.

Change-Id: I25da68d61afbe85687a040d449869b47e61073d4
2021-04-16 01:51:38 -07:00