Fix some pylint indentation warnings
Running with a stricter .pylintrc generates a lot of C0330 warnings (hanging/continued indentation). Fix some remaining ones in miscellaneous directories. Also cleanup any remaining code that I missed in this series, or has changed since I started. Trivialfix Change-Id: I17b4779020a7bfb369c3e721ab6638cd4a6ab50c
This commit is contained in:
parent
d250c83f23
commit
86badcfe2d
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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: '
|
||||
|
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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')
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user