diff --git a/neutron/agent/l3/extensions/qos/fip.py b/neutron/agent/l3/extensions/qos/fip.py index 03a260315aa..6d7b8bcb5c2 100644 --- a/neutron/agent/l3/extensions/qos/fip.py +++ b/neutron/agent/l3/extensions/qos/fip.py @@ -241,12 +241,13 @@ class FipQosAgentExtension(qos_base.L3QosAgentExtensionBase, self.fip_qos_map.clean_by_resource(fip_res) # process_ip_rate_limit will treat value 0 as # cleaning the tc filters if exits or no action. - return {constants.INGRESS_DIRECTION: { - "rate": qos_base.IP_DEFAULT_RATE, - "burst": qos_base.IP_DEFAULT_BURST}, - constants.EGRESS_DIRECTION: { - "rate": qos_base.IP_DEFAULT_RATE, - "burst": qos_base.IP_DEFAULT_BURST}} + return { + constants.INGRESS_DIRECTION: { + "rate": qos_base.IP_DEFAULT_RATE, + "burst": qos_base.IP_DEFAULT_BURST}, + constants.EGRESS_DIRECTION: { + "rate": qos_base.IP_DEFAULT_RATE, + "burst": qos_base.IP_DEFAULT_BURST}} policy = self.resource_rpc.pull( context, resources.QOS_POLICY, policy_id) self.fip_qos_map.set_resource_policy(fip_res, policy) diff --git a/neutron/agent/ovn/metadata/agent.py b/neutron/agent/ovn/metadata/agent.py index 3e49930cce8..45b60927b14 100644 --- a/neutron/agent/ovn/metadata/agent.py +++ b/neutron/agent/ovn/metadata/agent.py @@ -370,7 +370,7 @@ class MetadataAgent(object): ports = self.sb_idl.get_ports_on_chassis(self.chassis) return { str(p.datapath.uuid): ovn_utils.get_network_name_from_datapath( - p.datapath) + p.datapath) for p in self._vif_ports(ports) } diff --git a/neutron/cmd/ovn/migration_mtu.py b/neutron/cmd/ovn/migration_mtu.py index 821ff908be1..f9c94a9b3c5 100644 --- a/neutron/cmd/ovn/migration_mtu.py +++ b/neutron/cmd/ovn/migration_mtu.py @@ -83,8 +83,9 @@ def verify_network_mtu(): success = True for network in conn.network.networks(): if network.provider_physical_network is None and ( - network.provider_network_type in NETWORK_TYPE_OVERHEAD_DIFF) and ( - 'adapted_mtu' not in network.tags): + network.provider_network_type in + NETWORK_TYPE_OVERHEAD_DIFF) and ( + 'adapted_mtu' not in network.tags): print("adapted_mtu tag is not set for the Network " "[" + str(network.name) + "]") success = False diff --git a/neutron/cmd/sanitize_port_binding_profile_allocation.py b/neutron/cmd/sanitize_port_binding_profile_allocation.py index efab35afb87..c922087ea25 100644 --- a/neutron/cmd/sanitize_port_binding_profile_allocation.py +++ b/neutron/cmd/sanitize_port_binding_profile_allocation.py @@ -81,7 +81,8 @@ def main(): qos_port_binding.policy_id) continue - port_binding.profile = {'allocation': + port_binding.profile = { + 'allocation': converters.convert_to_sanitized_binding_profile_allocation( allocation, port_binding.port_id, min_bw_rules)} LOG.info('Port %s updated, New binding-profile.allocation format: ' diff --git a/neutron/debug/commands.py b/neutron/debug/commands.py index 6aa350e3f46..35fa34c0794 100644 --- a/neutron/debug/commands.py +++ b/neutron/debug/commands.py @@ -75,7 +75,7 @@ class ListProbe(ProbeCommand, lister.Lister): columns = sorted(info[0].keys()) if info else [] return (columns, (utils.get_item_properties( s, columns, formatters=self._formatters, ) - for s in info), ) + for s in info), ) class ClearProbe(ProbeCommand): diff --git a/neutron/hacking/checks.py b/neutron/hacking/checks.py index 487c5ce88f6..ffdcd71935b 100644 --- a/neutron/hacking/checks.py +++ b/neutron/hacking/checks.py @@ -149,8 +149,8 @@ def check_oslo_i18n_wrapper(logical_line, filename, noqa): if (len(split_line) > 1 and split_line[0] in ('import', 'from')): if (split_line[1] == bad_i18n_module or - modulename != 'neutron' and split_line[1] in ('neutron.i18n', - 'neutron._i18n')): + modulename != 'neutron' and split_line[1] in + ('neutron.i18n', 'neutron._i18n')): msg = ("N340: %(found)s is found. Use %(module)s._i18n instead." % {'found': split_line[1], 'module': modulename}) yield (0, msg) diff --git a/neutron/ipam/drivers/neutrondb_ipam/driver.py b/neutron/ipam/drivers/neutrondb_ipam/driver.py index 2641ce09566..51b54056214 100644 --- a/neutron/ipam/drivers/neutrondb_ipam/driver.py +++ b/neutron/ipam/drivers/neutrondb_ipam/driver.py @@ -226,7 +226,7 @@ class NeutronDbSubnet(ipam_base.Subnet): return allocated_ips raise ipam_exc.IpAddressGenerationFailure( - subnet_id=self.subnet_manager.neutron_id) + subnet_id=self.subnet_manager.neutron_id) def allocate(self, address_request): # NOTE(pbondar): Ipam driver is always called in context of already diff --git a/neutron/notifiers/ironic.py b/neutron/notifiers/ironic.py index e917c6aee44..59269c3db64 100644 --- a/neutron/notifiers/ironic.py +++ b/neutron/notifiers/ironic.py @@ -99,8 +99,8 @@ class Notifier(object): n_const.PORT_STATUS_ERROR]): port_event = 'unbind_port' elif (original_port_status == n_const.PORT_STATUS_DOWN and - current_port_status in [n_const.PORT_STATUS_ACTIVE, - n_const.PORT_STATUS_ERROR]): + current_port_status in [n_const.PORT_STATUS_ACTIVE, + n_const.PORT_STATUS_ERROR]): port_event = 'bind_port' LOG.debug('Queuing event for {event_type} for port {port} ' 'for status {status}.'.format(event_type=port_event, diff --git a/neutron/objects/ports.py b/neutron/objects/ports.py index 30367fb9db4..cfc7fdea7cd 100644 --- a/neutron/objects/ports.py +++ b/neutron/objects/ports.py @@ -108,7 +108,7 @@ class PortBinding(PortBindingBase): def get_duplicated_port_bindings(cls, context): return context.session.query( cls.db_model).group_by( - cls.db_model.port_id).having(sqlalchemy.func.count() > 1).all() + cls.db_model.port_id).having(sqlalchemy.func.count() > 1).all() @base.NeutronObjectRegistry.register diff --git a/neutron/pecan_wsgi/controllers/resource.py b/neutron/pecan_wsgi/controllers/resource.py index 6092d8bf15f..cebb03548e9 100644 --- a/neutron/pecan_wsgi/controllers/resource.py +++ b/neutron/pecan_wsgi/controllers/resource.py @@ -142,7 +142,7 @@ class CollectionsController(utils.NeutronPecanController): if 'parent_id' in request.context: lister_args.append(request.context['parent_id']) return {self.collection: self.plugin_lister(*lister_args, - **query_params)} + **query_params)} @utils.when(index, method='HEAD') @utils.when(index, method='PATCH') diff --git a/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py b/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py index 2a4a639ba15..399b1375055 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py @@ -77,11 +77,13 @@ class SriovNicSwitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): vnic_type_prohibit_list=prohibit_list) # NOTE(ndipanov): PF passthrough requires a different vif type + def _vif_type(vtype): + return (portbindings.VIF_TYPE_HOSTDEV_PHY + if vtype == portbindings.VNIC_DIRECT_PHYSICAL + else portbindings.VIF_TYPE_HW_VEB) + self.vnic_type_for_vif_type = ( - {vtype: portbindings.VIF_TYPE_HOSTDEV_PHY - if vtype == portbindings.VNIC_DIRECT_PHYSICAL - else portbindings.VIF_TYPE_HW_VEB - for vtype in self.supported_vnic_types}) + {vtype: _vif_type(vtype) for vtype in self.supported_vnic_types}) self.vif_details = vif_details sriov_qos_driver.register() diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py b/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py index bc7815e74c0..a8155d70ef0 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py @@ -109,7 +109,7 @@ class MeterRuleManager(object): key = self.get_data_key(port_id, direction) try: meter_id = self.br_int.get_value_from_other_config( - port_name, key, value_type=int) + port_name, key, value_type=int) self.generator.set_meter_id(key, meter_id) return meter_id except Exception: diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py index 18623f7006c..9a627d8b3d6 100644 --- a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py +++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py @@ -547,14 +547,12 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase): context = n_context.get_admin_context() with self._nb_idl.transaction(check_error=True) as txn: for port in ports: - if ( - port.external_ids.get( - ovn_const.OVN_SUBNET_POOL_EXT_ADDR_SCOPE4_KEY - ) is None or - port.external_ids.get( - ovn_const.OVN_SUBNET_POOL_EXT_ADDR_SCOPE6_KEY - ) is None - ): + if (port.external_ids.get( + ovn_const.OVN_SUBNET_POOL_EXT_ADDR_SCOPE4_KEY) + is None or + port.external_ids.get( + ovn_const.OVN_SUBNET_POOL_EXT_ADDR_SCOPE6_KEY) + is None): try: port_neutron = self._ovn_client._plugin.get_port( context, port.name diff --git a/neutron/privileged/agent/linux/ip_lib.py b/neutron/privileged/agent/linux/ip_lib.py index 7ad3af03349..23d7dfcd3b5 100644 --- a/neutron/privileged/agent/linux/ip_lib.py +++ b/neutron/privileged/agent/linux/ip_lib.py @@ -72,7 +72,7 @@ class NetworkInterfaceNotFound(RuntimeError): # and will call it always with passing only message from originally # raised exception. message = message or self.message % { - 'device': device, 'namespace': namespace} + 'device': device, 'namespace': namespace} super(NetworkInterfaceNotFound, self).__init__(message) @@ -87,7 +87,7 @@ class InterfaceOperationNotSupported(RuntimeError): # and will call it always with passing only message from originally # raised exception. message = message or self.message % { - 'device': device, 'namespace': namespace} + 'device': device, 'namespace': namespace} super(InterfaceOperationNotSupported, self).__init__(message) diff --git a/neutron/profiling/profiled_decorator.py b/neutron/profiling/profiled_decorator.py index 1d304f5d5dd..20654263107 100644 --- a/neutron/profiling/profiled_decorator.py +++ b/neutron/profiling/profiled_decorator.py @@ -55,7 +55,7 @@ def profile(f): profiler.disable() elapsed_time = datetime.now() - start_time elapsed_time_ms = (elapsed_time.seconds * 1000.0 + - elapsed_time.microseconds / 1000.0) + elapsed_time.microseconds / 1000.0) stream = io.StringIO() stats = pstats.Stats(profiler, stream=stream).sort_stats( SORT_BY) diff --git a/neutron/services/logapi/drivers/ovn/driver.py b/neutron/services/logapi/drivers/ovn/driver.py index 4ad67e6a434..c5d10a669c9 100644 --- a/neutron/services/logapi/drivers/ovn/driver.py +++ b/neutron/services/logapi/drivers/ovn/driver.py @@ -335,8 +335,8 @@ class OVNDriver(base.DriverBase): self._remove_acls_log(acls_to_remove, ovn_txn) else: all_events = set([log.event for log in other_logs - if (not log.resource_id or - log.resource_id == log_obj.resource_id)]) + if (not log.resource_id or + log.resource_id == log_obj.resource_id)]) if (log_const.ALL_EVENT not in all_events and log_obj.event not in all_events): self._remove_acls_log(pgs, ovn_txn)