Skip to content

Commit 0f7f95b

Browse files
committed
neutron: Rework how we check for extensions
There are couple of changes we can make here: - Always attempt to refresh the cache before checking if an extension is enabled. - Using extension slugs as our reference point rather than extension names. They seem like a better thing to use as a constant and are similarly fixed. - Be consistent in how we name and call the extension check functions - Add documentation for what each extension doing/used for There's a TODO here to remove some code that relies on an out-of-tree extension that I can't see. That's done separately since this is already big enough. Change-Id: I8058902df167239fa455396d3595a56bcf472b2b Signed-off-by: Stephen Finucane <[email protected]>
1 parent 75f719e commit 0f7f95b

File tree

14 files changed

+293
-169
lines changed

14 files changed

+293
-169
lines changed

nova/compute/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8039,7 +8039,7 @@ def check_can_live_migrate_destination(self, ctxt, instance,
80398039
LOG.info('Destination was ready for NUMA live migration, '
80408040
'but source is either too old, or is set to an '
80418041
'older upgrade level.', instance=instance)
8042-
if self.network_api.supports_port_binding_extension(ctxt):
8042+
if self.network_api.has_port_binding_extension(ctxt):
80438043
# Create migrate_data vifs if not provided by driver.
80448044
if 'vifs' not in migrate_data:
80458045
migrate_data.vifs = (

nova/conductor/tasks/cross_cell_migrate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ def _perform_external_api_checks(self):
697697
LOG.debug('Making sure neutron is new enough for cross-cell resize.')
698698
# Check that the port binding-extended API extension is available in
699699
# neutron because if it's not we can just fail fast.
700-
if not self.network_api.supports_port_binding_extension(self.context):
700+
if not self.network_api.has_port_binding_extension(self.context):
701701
raise exception.MigrationPreCheckError(
702702
reason=_("Required networking service API extension '%s' "
703703
"not found.") %

nova/conductor/tasks/live_migrate.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,7 @@ def _check_can_migrate_pci(self, src_host, dest_host):
245245
"are not allowed for live migration.")
246246
# All PCI requests are VIF related, now check neutron,
247247
# source and destination compute nodes.
248-
if not self.network_api.supports_port_binding_extension(
249-
self.context):
248+
if not self.network_api.has_port_binding_extension(self.context):
250249
raise exception.MigrationPreCheckError(
251250
reason="Cannot live migrate VIF with related PCI, Neutron "
252251
"does not support required port binding extension.")
@@ -366,7 +365,7 @@ def _call_livem_checks_on_host(self, destination, provider_mapping):
366365
raise exception.MigrationPreCheckError(msg)
367366

368367
# Check to see that neutron supports the binding-extended API.
369-
if self.network_api.supports_port_binding_extension(self.context):
368+
if self.network_api.has_port_binding_extension(self.context):
370369
bindings = self._bind_ports_on_destination(
371370
destination, provider_mapping)
372371
self._update_migrate_vifs_from_bindings(self.migrate_data.vifs,

nova/network/constants.py

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,40 @@
1313
# License for the specific language governing permissions and limitations
1414
# under the License.
1515

16-
QOS_QUEUE = 'QoS Queue'
17-
NET_EXTERNAL = 'router:external'
18-
VNIC_INDEX_EXT = 'VNIC Index'
19-
DNS_INTEGRATION = 'DNS Integration'
20-
MULTI_NET_EXT = 'Multi Provider Network'
21-
FIP_PORT_DETAILS = 'Floating IP Port Details Extension'
22-
SUBSTR_PORT_FILTERING = 'IP address substring filtering'
23-
PORT_BINDING = 'Port Binding'
24-
PORT_BINDING_EXTENDED = 'Port Bindings Extended'
25-
DEFAULT_SECGROUP = 'default'
16+
# Port fields
17+
2618
BINDING_PROFILE = 'binding:profile'
2719
BINDING_HOST_ID = 'binding:host_id'
28-
MIGRATING_ATTR = 'migrating_to'
29-
L3_NETWORK_TYPES = ['vxlan', 'gre', 'geneve']
30-
ALLOCATION = 'allocation'
3120
RESOURCE_REQUEST = 'resource_request'
3221
REQUEST_GROUPS = 'request_groups'
33-
SEGMENT = 'Segment'
3422
NUMA_POLICY = 'numa_affinity_policy'
35-
RESOURCE_REQUEST_GROUPS_EXTENSION = "Port Resource Request Groups"
23+
24+
# Binding profile fields
25+
26+
MIGRATING_ATTR = 'migrating_to'
27+
ALLOCATION = 'allocation'
28+
29+
# Core extensions
30+
31+
DNS_INTEGRATION = 'dns-integration'
32+
MULTI_PROVIDER = 'multi-provider'
33+
FIP_PORT_DETAILS = 'fip-port-details'
34+
PORT_BINDING = 'binding'
35+
PORT_BINDING_EXTENDED = 'binding-extended'
36+
SUBSTR_PORT_FILTERING = 'ip-substring-filtering'
37+
SEGMENT = 'segment'
38+
RESOURCE_REQUEST_GROUPS = 'port-resource-request-groups'
39+
40+
# Third-party extensions
41+
42+
VNIC_INDEX = 'vnic-index' # this is provided by the vmware_nsx project
43+
QOS_QUEUE = 'qos-queue' # TODO(stephenfin): what defines this? Xen?
44+
45+
# Search fields
46+
47+
NET_EXTERNAL = 'router:external'
48+
49+
# Misc
50+
51+
DEFAULT_SECGROUP = 'default'
52+
L3_NETWORK_TYPES = ['vxlan', 'gre', 'geneve']

0 commit comments

Comments
 (0)