From 3c73896a798048fc2b10d674d8f15040e2596e3a Mon Sep 17 00:00:00 2001 From: Aaron Rosen Date: Mon, 12 Jan 2015 13:55:32 -0800 Subject: [PATCH] Rename qexception->nexception A few qexception references where still present in the code this patch renames them to nexecption. find . -name "*.py" -print | xargs sed -i 's/qexception/nexception/g' TrivialFix Change-Id: I9530c7a23deb3a40c3720bc8fc99ce09dbd88dd9 --- neutron/extensions/external_net.py | 4 +- neutron/extensions/extraroute.py | 8 ++-- neutron/extensions/firewall.py | 38 ++++++++--------- neutron/extensions/l3.py | 22 +++++----- neutron/extensions/loadbalancer.py | 32 +++++++------- neutron/extensions/loadbalancerv2.py | 28 ++++++------- neutron/extensions/metering.py | 10 ++--- neutron/extensions/multiprovidernet.py | 6 +-- neutron/extensions/portsecurity.py | 8 ++-- neutron/extensions/securitygroup.py | 42 +++++++++---------- neutron/extensions/vpnaas.py | 32 +++++++------- .../bigswitch/extensions/routerrule.py | 12 +++--- neutron/plugins/vmware/extensions/qos.py | 22 +++++----- 13 files changed, 132 insertions(+), 132 deletions(-) diff --git a/neutron/extensions/external_net.py b/neutron/extensions/external_net.py index 0e24f13f6..2a985f9d3 100644 --- a/neutron/extensions/external_net.py +++ b/neutron/extensions/external_net.py @@ -15,11 +15,11 @@ from neutron.api import extensions from neutron.api.v2 import attributes as attr -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception from neutron.extensions import l3 -class ExternalNetworkInUse(qexception.InUse): +class ExternalNetworkInUse(nexception.InUse): message = _("External network %(net_id)s cannot be updated to be made " "non-external, since it has existing gateway ports") diff --git a/neutron/extensions/extraroute.py b/neutron/extensions/extraroute.py index 7c63baa22..d7968cdf8 100644 --- a/neutron/extensions/extraroute.py +++ b/neutron/extensions/extraroute.py @@ -15,21 +15,21 @@ from neutron.api.v2 import attributes as attr -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception # Extra Routes Exceptions -class InvalidRoutes(qexception.InvalidInput): +class InvalidRoutes(nexception.InvalidInput): message = _("Invalid format for routes: %(routes)s, %(reason)s") -class RouterInterfaceInUseByRoute(qexception.InUse): +class RouterInterfaceInUseByRoute(nexception.InUse): message = _("Router interface for subnet %(subnet_id)s on router " "%(router_id)s cannot be deleted, as it is required " "by one or more routes.") -class RoutesExhausted(qexception.BadRequest): +class RoutesExhausted(nexception.BadRequest): message = _("Unable to complete operation for %(router_id)s. " "The number of routes exceeds the maximum %(quota)s.") diff --git a/neutron/extensions/firewall.py b/neutron/extensions/firewall.py index d7cbb1f0a..4e76c9a49 100644 --- a/neutron/extensions/firewall.py +++ b/neutron/extensions/firewall.py @@ -21,7 +21,7 @@ import six from neutron.api import extensions from neutron.api.v2 import attributes as attr from neutron.api.v2 import resource_helper -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.services import service_base @@ -31,28 +31,28 @@ LOG = logging.getLogger(__name__) # Firewall Exceptions -class FirewallNotFound(qexception.NotFound): +class FirewallNotFound(nexception.NotFound): message = _("Firewall %(firewall_id)s could not be found.") -class FirewallInUse(qexception.InUse): +class FirewallInUse(nexception.InUse): message = _("Firewall %(firewall_id)s is still active.") -class FirewallInPendingState(qexception.Conflict): +class FirewallInPendingState(nexception.Conflict): message = _("Operation cannot be performed since associated Firewall " "%(firewall_id)s is in %(pending_state)s.") -class FirewallPolicyNotFound(qexception.NotFound): +class FirewallPolicyNotFound(nexception.NotFound): message = _("Firewall Policy %(firewall_policy_id)s could not be found.") -class FirewallPolicyInUse(qexception.InUse): +class FirewallPolicyInUse(nexception.InUse): message = _("Firewall Policy %(firewall_policy_id)s is being used.") -class FirewallRuleSharingConflict(qexception.Conflict): +class FirewallRuleSharingConflict(nexception.Conflict): """FWaaS exception for firewall rules @@ -64,7 +64,7 @@ class FirewallRuleSharingConflict(qexception.Conflict): "%(firewall_rule_id)s is not shared") -class FirewallPolicySharingConflict(qexception.Conflict): +class FirewallPolicySharingConflict(nexception.Conflict): """FWaaS exception for firewall policy @@ -76,49 +76,49 @@ class FirewallPolicySharingConflict(qexception.Conflict): "Rule %(firewall_rule_id)s") -class FirewallRuleNotFound(qexception.NotFound): +class FirewallRuleNotFound(nexception.NotFound): message = _("Firewall Rule %(firewall_rule_id)s could not be found.") -class FirewallRuleInUse(qexception.InUse): +class FirewallRuleInUse(nexception.InUse): message = _("Firewall Rule %(firewall_rule_id)s is being used.") -class FirewallRuleNotAssociatedWithPolicy(qexception.InvalidInput): +class FirewallRuleNotAssociatedWithPolicy(nexception.InvalidInput): message = _("Firewall Rule %(firewall_rule_id)s is not associated " " with Firewall Policy %(firewall_policy_id)s.") -class FirewallRuleInvalidProtocol(qexception.InvalidInput): +class FirewallRuleInvalidProtocol(nexception.InvalidInput): message = _("Firewall Rule protocol %(protocol)s is not supported. " "Only protocol values %(values)s and their integer " "representation (0 to 255) are supported.") -class FirewallRuleInvalidAction(qexception.InvalidInput): +class FirewallRuleInvalidAction(nexception.InvalidInput): message = _("Firewall rule action %(action)s is not supported. " "Only action values %(values)s are supported.") -class FirewallRuleInvalidICMPParameter(qexception.InvalidInput): +class FirewallRuleInvalidICMPParameter(nexception.InvalidInput): message = _("%(param)s are not allowed when protocol " "is set to ICMP.") -class FirewallRuleWithPortWithoutProtocolInvalid(qexception.InvalidInput): +class FirewallRuleWithPortWithoutProtocolInvalid(nexception.InvalidInput): message = _("Source/destination port requires a protocol") -class FirewallInvalidPortValue(qexception.InvalidInput): +class FirewallInvalidPortValue(nexception.InvalidInput): message = _("Invalid value for port %(port)s.") -class FirewallRuleInfoMissing(qexception.InvalidInput): +class FirewallRuleInfoMissing(nexception.InvalidInput): message = _("Missing rule info argument for insert/remove " "rule operation.") -class FirewallInternalDriverError(qexception.NeutronException): +class FirewallInternalDriverError(nexception.NeutronException): """Fwaas exception for all driver errors. On any failure or exception in the driver, driver should log it and @@ -127,7 +127,7 @@ class FirewallInternalDriverError(qexception.NeutronException): message = _("%(driver)s: Internal driver error.") -class FirewallRuleConflict(qexception.Conflict): +class FirewallRuleConflict(nexception.Conflict): """Firewall rule conflict exception. diff --git a/neutron/extensions/l3.py b/neutron/extensions/l3.py index e1106cda0..5f1195c6a 100644 --- a/neutron/extensions/l3.py +++ b/neutron/extensions/l3.py @@ -20,58 +20,58 @@ from oslo.config import cfg from neutron.api import extensions from neutron.api.v2 import attributes as attr from neutron.api.v2 import resource_helper -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception from neutron.plugins.common import constants # L3 Exceptions -class RouterNotFound(qexception.NotFound): +class RouterNotFound(nexception.NotFound): message = _("Router %(router_id)s could not be found") -class RouterInUse(qexception.InUse): +class RouterInUse(nexception.InUse): message = _("Router %(router_id)s still has ports") -class RouterInterfaceNotFound(qexception.NotFound): +class RouterInterfaceNotFound(nexception.NotFound): message = _("Router %(router_id)s does not have " "an interface with id %(port_id)s") -class RouterInterfaceNotFoundForSubnet(qexception.NotFound): +class RouterInterfaceNotFoundForSubnet(nexception.NotFound): message = _("Router %(router_id)s has no interface " "on subnet %(subnet_id)s") -class RouterInterfaceInUseByFloatingIP(qexception.InUse): +class RouterInterfaceInUseByFloatingIP(nexception.InUse): message = _("Router interface for subnet %(subnet_id)s on router " "%(router_id)s cannot be deleted, as it is required " "by one or more floating IPs.") -class FloatingIPNotFound(qexception.NotFound): +class FloatingIPNotFound(nexception.NotFound): message = _("Floating IP %(floatingip_id)s could not be found") -class ExternalGatewayForFloatingIPNotFound(qexception.NotFound): +class ExternalGatewayForFloatingIPNotFound(nexception.NotFound): message = _("External network %(external_network_id)s is not reachable " "from subnet %(subnet_id)s. Therefore, cannot associate " "Port %(port_id)s with a Floating IP.") -class FloatingIPPortAlreadyAssociated(qexception.InUse): +class FloatingIPPortAlreadyAssociated(nexception.InUse): message = _("Cannot associate floating IP %(floating_ip_address)s " "(%(fip_id)s) with port %(port_id)s " "using fixed IP %(fixed_ip)s, as that fixed IP already " "has a floating IP on external network %(net_id)s.") -class L3PortInUse(qexception.InUse): +class L3PortInUse(nexception.InUse): message = _("Port %(port_id)s has owner %(device_owner)s and therefore" " cannot be deleted directly via the port API.") -class RouterExternalGatewayInUseByFloatingIp(qexception.InUse): +class RouterExternalGatewayInUseByFloatingIp(nexception.InUse): message = _("Gateway cannot be updated for router %(router_id)s, since a " "gateway to external network %(net_id)s is required by one or " "more floating IPs.") diff --git a/neutron/extensions/loadbalancer.py b/neutron/extensions/loadbalancer.py index 40ef4d9be..54650cfd3 100644 --- a/neutron/extensions/loadbalancer.py +++ b/neutron/extensions/loadbalancer.py @@ -22,74 +22,74 @@ from neutron.api import extensions from neutron.api.v2 import attributes as attr from neutron.api.v2 import base from neutron.api.v2 import resource_helper -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception from neutron import manager from neutron.plugins.common import constants from neutron.services import service_base # Loadbalancer Exceptions -class DelayOrTimeoutInvalid(qexception.BadRequest): +class DelayOrTimeoutInvalid(nexception.BadRequest): message = _("Delay must be greater than or equal to timeout") -class NoEligibleBackend(qexception.NotFound): +class NoEligibleBackend(nexception.NotFound): message = _("No eligible backend for pool %(pool_id)s") -class VipNotFound(qexception.NotFound): +class VipNotFound(nexception.NotFound): message = _("Vip %(vip_id)s could not be found") -class VipExists(qexception.NeutronException): +class VipExists(nexception.NeutronException): message = _("Another Vip already exists for pool %(pool_id)s") -class PoolNotFound(qexception.NotFound): +class PoolNotFound(nexception.NotFound): message = _("Pool %(pool_id)s could not be found") -class MemberNotFound(qexception.NotFound): +class MemberNotFound(nexception.NotFound): message = _("Member %(member_id)s could not be found") -class HealthMonitorNotFound(qexception.NotFound): +class HealthMonitorNotFound(nexception.NotFound): message = _("Health_monitor %(monitor_id)s could not be found") -class PoolMonitorAssociationNotFound(qexception.NotFound): +class PoolMonitorAssociationNotFound(nexception.NotFound): message = _("Monitor %(monitor_id)s is not associated " "with Pool %(pool_id)s") -class PoolMonitorAssociationExists(qexception.Conflict): +class PoolMonitorAssociationExists(nexception.Conflict): message = _('health_monitor %(monitor_id)s is already associated ' 'with pool %(pool_id)s') -class StateInvalid(qexception.NeutronException): +class StateInvalid(nexception.NeutronException): message = _("Invalid state %(state)s of Loadbalancer resource %(id)s") -class PoolInUse(qexception.InUse): +class PoolInUse(nexception.InUse): message = _("Pool %(pool_id)s is still in use") -class HealthMonitorInUse(qexception.InUse): +class HealthMonitorInUse(nexception.InUse): message = _("Health monitor %(monitor_id)s still has associations with " "pools") -class PoolStatsNotFound(qexception.NotFound): +class PoolStatsNotFound(nexception.NotFound): message = _("Statistics of Pool %(pool_id)s could not be found") -class ProtocolMismatch(qexception.BadRequest): +class ProtocolMismatch(nexception.BadRequest): message = _("Protocol %(vip_proto)s does not match " "pool protocol %(pool_proto)s") -class MemberExists(qexception.NeutronException): +class MemberExists(nexception.NeutronException): message = _("Member with address %(address)s and port %(port)s " "already present in pool %(pool)s") diff --git a/neutron/extensions/loadbalancerv2.py b/neutron/extensions/loadbalancerv2.py index 8ecb5b683..79c954219 100644 --- a/neutron/extensions/loadbalancerv2.py +++ b/neutron/extensions/loadbalancerv2.py @@ -23,7 +23,7 @@ from neutron.api import extensions from neutron.api.v2 import attributes as attr from neutron.api.v2 import base from neutron.api.v2 import resource_helper -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception from neutron import manager from neutron.plugins.common import constants from neutron.services import service_base @@ -63,59 +63,59 @@ SUPPORTED_SP_TYPES = (SESSION_PERSISTENCE_SOURCE_IP, # Loadbalancer Exceptions # This exception is only for a workaround when having v1 and v2 lbaas extension # and plugins enabled -class RequiredAttributeNotSpecified(qexception.BadRequest): +class RequiredAttributeNotSpecified(nexception.BadRequest): message = _("Required attribute %(attr_name)s not specified") -class EntityNotFound(qexception.NotFound): +class EntityNotFound(nexception.NotFound): message = _("%(name)s %(id)s could not be found") -class DelayOrTimeoutInvalid(qexception.BadRequest): +class DelayOrTimeoutInvalid(nexception.BadRequest): message = _("Delay must be greater than or equal to timeout") -class EntityInUse(qexception.InUse): +class EntityInUse(nexception.InUse): message = _("%(entity_using)s %(id)s is using this %(entity_in_use)s") -class LoadBalancerListenerProtocolPortExists(qexception.Conflict): +class LoadBalancerListenerProtocolPortExists(nexception.Conflict): message = _("Load Balancer %(lb_id)s already has a listener with " "protocol_port of %(protocol_port)s") -class ListenerPoolProtocolMismatch(qexception.Conflict): +class ListenerPoolProtocolMismatch(nexception.Conflict): message = _("Listener protocol %(listener_proto)s and pool protocol " "%(pool_proto)s are not compatible.") -class AttributeIDImmutable(qexception.NeutronException): +class AttributeIDImmutable(nexception.NeutronException): message = _("Cannot change %(attribute)s if one already exists") -class StateInvalid(qexception.NeutronException): +class StateInvalid(nexception.NeutronException): message = _("Invalid state %(state)s of loadbalancer resource %(id)s") -class MemberNotFoundForPool(qexception.NotFound): +class MemberNotFoundForPool(nexception.NotFound): message = _("Member %(member_id)s could not be found in pool %(pool_id)s") -class MemberExists(qexception.Conflict): +class MemberExists(nexception.Conflict): message = _("Member with address %(address)s and protocol_port %(port)s " "already present in pool %(pool)s") -class MemberAddressTypeSubnetTypeMismatch(qexception.NeutronException): +class MemberAddressTypeSubnetTypeMismatch(nexception.NeutronException): message = _("Member with address %(address)s and subnet %(subnet_id) " " have mismatched IP versions") -class DriverError(qexception.NeutronException): +class DriverError(nexception.NeutronException): message = _("An error happened in the driver") -class LBConfigurationUnsupported(qexception.NeutronException): +class LBConfigurationUnsupported(nexception.NeutronException): message = _("Load balancer %(load_balancer_id)s configuration is not" "supported by driver %(driver_name)s") diff --git a/neutron/extensions/metering.py b/neutron/extensions/metering.py index 5be35a7d4..065367999 100644 --- a/neutron/extensions/metering.py +++ b/neutron/extensions/metering.py @@ -19,7 +19,7 @@ import six from neutron.api import extensions from neutron.api.v2 import attributes as attr from neutron.api.v2 import resource_helper -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.services import service_base @@ -27,19 +27,19 @@ from neutron.services import service_base LOG = logging.getLogger(__name__) -class MeteringLabelNotFound(qexception.NotFound): +class MeteringLabelNotFound(nexception.NotFound): message = _("Metering label %(label_id)s does not exist") -class DuplicateMeteringRuleInPost(qexception.InUse): +class DuplicateMeteringRuleInPost(nexception.InUse): message = _("Duplicate Metering Rule in POST.") -class MeteringLabelRuleNotFound(qexception.NotFound): +class MeteringLabelRuleNotFound(nexception.NotFound): message = _("Metering label rule %(rule_id)s does not exist") -class MeteringLabelRuleOverlaps(qexception.Conflict): +class MeteringLabelRuleOverlaps(nexception.Conflict): message = _("Metering label rule with remote_ip_prefix " "%(remote_ip_prefix)s overlaps another") diff --git a/neutron/extensions/multiprovidernet.py b/neutron/extensions/multiprovidernet.py index 5df48f635..4fba23fbd 100644 --- a/neutron/extensions/multiprovidernet.py +++ b/neutron/extensions/multiprovidernet.py @@ -17,17 +17,17 @@ import webob.exc from neutron.api import extensions from neutron.api.v2 import attributes as attr -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception from neutron.extensions import providernet as pnet SEGMENTS = 'segments' -class SegmentsSetInConjunctionWithProviders(qexception.InvalidInput): +class SegmentsSetInConjunctionWithProviders(nexception.InvalidInput): message = _("Segments and provider values cannot both be set.") -class SegmentsContainDuplicateEntry(qexception.InvalidInput): +class SegmentsContainDuplicateEntry(nexception.InvalidInput): message = _("Duplicate segment entry in request.") diff --git a/neutron/extensions/portsecurity.py b/neutron/extensions/portsecurity.py index b652436ed..68663f9e1 100644 --- a/neutron/extensions/portsecurity.py +++ b/neutron/extensions/portsecurity.py @@ -13,20 +13,20 @@ # under the License. from neutron.api.v2 import attributes -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception -class PortSecurityPortHasSecurityGroup(qexception.InUse): +class PortSecurityPortHasSecurityGroup(nexception.InUse): message = _("Port has security group associated. Cannot disable port " "security or ip address until security group is removed") -class PortSecurityAndIPRequiredForSecurityGroups(qexception.InvalidInput): +class PortSecurityAndIPRequiredForSecurityGroups(nexception.InvalidInput): message = _("Port security must be enabled and port must have an IP" " address in order to use security groups.") -class PortSecurityBindingNotFound(qexception.InvalidExtensionEnv): +class PortSecurityBindingNotFound(nexception.InvalidExtensionEnv): message = _("Port does not have port security binding.") PORTSECURITY = 'port_security_enabled' diff --git a/neutron/extensions/securitygroup.py b/neutron/extensions/securitygroup.py index 61e281483..0934d6537 100644 --- a/neutron/extensions/securitygroup.py +++ b/neutron/extensions/securitygroup.py @@ -23,90 +23,90 @@ from neutron.api import extensions from neutron.api.v2 import attributes as attr from neutron.api.v2 import base from neutron.common import constants as const -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception from neutron import manager from neutron.openstack.common import uuidutils from neutron import quota # Security group Exceptions -class SecurityGroupInvalidPortRange(qexception.InvalidInput): +class SecurityGroupInvalidPortRange(nexception.InvalidInput): message = _("For TCP/UDP protocols, port_range_min must be " "<= port_range_max") -class SecurityGroupInvalidPortValue(qexception.InvalidInput): +class SecurityGroupInvalidPortValue(nexception.InvalidInput): message = _("Invalid value for port %(port)s") -class SecurityGroupInvalidIcmpValue(qexception.InvalidInput): +class SecurityGroupInvalidIcmpValue(nexception.InvalidInput): message = _("Invalid value for ICMP %(field)s (%(attr)s) " "%(value)s. It must be 0 to 255.") -class SecurityGroupMissingIcmpType(qexception.InvalidInput): +class SecurityGroupMissingIcmpType(nexception.InvalidInput): message = _("ICMP code (port-range-max) %(value)s is provided" " but ICMP type (port-range-min) is missing.") -class SecurityGroupInUse(qexception.InUse): +class SecurityGroupInUse(nexception.InUse): message = _("Security Group %(id)s in use.") -class SecurityGroupCannotRemoveDefault(qexception.InUse): +class SecurityGroupCannotRemoveDefault(nexception.InUse): message = _("Insufficient rights for removing default security group.") -class SecurityGroupCannotUpdateDefault(qexception.InUse): +class SecurityGroupCannotUpdateDefault(nexception.InUse): message = _("Updating default security group not allowed.") -class SecurityGroupDefaultAlreadyExists(qexception.InUse): +class SecurityGroupDefaultAlreadyExists(nexception.InUse): message = _("Default security group already exists.") -class SecurityGroupRuleInvalidProtocol(qexception.InvalidInput): +class SecurityGroupRuleInvalidProtocol(nexception.InvalidInput): message = _("Security group rule protocol %(protocol)s not supported. " "Only protocol values %(values)s and their integer " "representation (0 to 255) are supported.") -class SecurityGroupRulesNotSingleTenant(qexception.InvalidInput): +class SecurityGroupRulesNotSingleTenant(nexception.InvalidInput): message = _("Multiple tenant_ids in bulk security group rule create" " not allowed") -class SecurityGroupRemoteGroupAndRemoteIpPrefix(qexception.InvalidInput): +class SecurityGroupRemoteGroupAndRemoteIpPrefix(nexception.InvalidInput): message = _("Only remote_ip_prefix or remote_group_id may " "be provided.") -class SecurityGroupProtocolRequiredWithPorts(qexception.InvalidInput): +class SecurityGroupProtocolRequiredWithPorts(nexception.InvalidInput): message = _("Must also specifiy protocol if port range is given.") -class SecurityGroupNotSingleGroupRules(qexception.InvalidInput): +class SecurityGroupNotSingleGroupRules(nexception.InvalidInput): message = _("Only allowed to update rules for " "one security profile at a time") -class SecurityGroupNotFound(qexception.NotFound): +class SecurityGroupNotFound(nexception.NotFound): message = _("Security group %(id)s does not exist") -class SecurityGroupRuleNotFound(qexception.NotFound): +class SecurityGroupRuleNotFound(nexception.NotFound): message = _("Security group rule %(id)s does not exist") -class DuplicateSecurityGroupRuleInPost(qexception.InUse): +class DuplicateSecurityGroupRuleInPost(nexception.InUse): message = _("Duplicate Security Group Rule in POST.") -class SecurityGroupRuleExists(qexception.InUse): +class SecurityGroupRuleExists(nexception.InUse): message = _("Security group rule already exists. Rule id is %(id)s.") -class SecurityGroupRuleParameterConflict(qexception.InvalidInput): +class SecurityGroupRuleParameterConflict(nexception.InvalidInput): message = _("Conflicting value ethertype %(ethertype)s for CIDR %(cidr)s") @@ -159,7 +159,7 @@ def convert_to_uuid_list_or_none(value_list): for sg_id in value_list: if not uuidutils.is_uuid_like(sg_id): msg = _("'%s' is not an integer or uuid") % sg_id - raise qexception.InvalidInput(error_message=msg) + raise nexception.InvalidInput(error_message=msg) return value_list @@ -170,7 +170,7 @@ def convert_ip_prefix_to_cidr(ip_prefix): cidr = netaddr.IPNetwork(ip_prefix) return str(cidr) except (ValueError, TypeError, netaddr.AddrFormatError): - raise qexception.InvalidCIDR(input=ip_prefix) + raise nexception.InvalidCIDR(input=ip_prefix) def _validate_name_not_default(data, valid_values=None): diff --git a/neutron/extensions/vpnaas.py b/neutron/extensions/vpnaas.py index fc32d2ace..22768249a 100644 --- a/neutron/extensions/vpnaas.py +++ b/neutron/extensions/vpnaas.py @@ -20,74 +20,74 @@ import six from neutron.api import extensions from neutron.api.v2 import attributes as attr from neutron.api.v2 import resource_helper -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception from neutron.plugins.common import constants from neutron.services import service_base -class VPNServiceNotFound(qexception.NotFound): +class VPNServiceNotFound(nexception.NotFound): message = _("VPNService %(vpnservice_id)s could not be found") -class IPsecSiteConnectionNotFound(qexception.NotFound): +class IPsecSiteConnectionNotFound(nexception.NotFound): message = _("ipsec_site_connection %(ipsec_site_conn_id)s not found") -class IPsecSiteConnectionDpdIntervalValueError(qexception.InvalidInput): +class IPsecSiteConnectionDpdIntervalValueError(nexception.InvalidInput): message = _("ipsec_site_connection %(attr)s is " "equal to or less than dpd_interval") -class IPsecSiteConnectionMtuError(qexception.InvalidInput): +class IPsecSiteConnectionMtuError(nexception.InvalidInput): message = _("ipsec_site_connection MTU %(mtu)d is too small " "for ipv%(version)s") -class IKEPolicyNotFound(qexception.NotFound): +class IKEPolicyNotFound(nexception.NotFound): message = _("IKEPolicy %(ikepolicy_id)s could not be found") -class IPsecPolicyNotFound(qexception.NotFound): +class IPsecPolicyNotFound(nexception.NotFound): message = _("IPsecPolicy %(ipsecpolicy_id)s could not be found") -class IKEPolicyInUse(qexception.InUse): +class IKEPolicyInUse(nexception.InUse): message = _("IKEPolicy %(ikepolicy_id)s is in use by existing " "IPsecSiteConnection and can't be updated or deleted") -class VPNServiceInUse(qexception.InUse): +class VPNServiceInUse(nexception.InUse): message = _("VPNService %(vpnservice_id)s is still in use") -class RouterInUseByVPNService(qexception.InUse): +class RouterInUseByVPNService(nexception.InUse): message = _("Router %(router_id)s is used by VPNService %(vpnservice_id)s") -class SubnetInUseByVPNService(qexception.InUse): +class SubnetInUseByVPNService(nexception.InUse): message = _("Subnet %(subnet_id)s is used by VPNService %(vpnservice_id)s") -class VPNStateInvalidToUpdate(qexception.BadRequest): +class VPNStateInvalidToUpdate(nexception.BadRequest): message = _("Invalid state %(state)s of vpnaas resource %(id)s" " for updating") -class IPsecPolicyInUse(qexception.InUse): +class IPsecPolicyInUse(nexception.InUse): message = _("IPsecPolicy %(ipsecpolicy_id)s is in use by existing " "IPsecSiteConnection and can't be updated or deleted") -class DeviceDriverImportError(qexception.NeutronException): +class DeviceDriverImportError(nexception.NeutronException): message = _("Can not load driver :%(device_driver)s") -class SubnetIsNotConnectedToRouter(qexception.BadRequest): +class SubnetIsNotConnectedToRouter(nexception.BadRequest): message = _("Subnet %(subnet_id)s is not " "connected to Router %(router_id)s") -class RouterIsNotExternal(qexception.BadRequest): +class RouterIsNotExternal(nexception.BadRequest): message = _("Router %(router_id)s has no external network gateway set") diff --git a/neutron/plugins/bigswitch/extensions/routerrule.py b/neutron/plugins/bigswitch/extensions/routerrule.py index 9cabfde4b..61e87d639 100644 --- a/neutron/plugins/bigswitch/extensions/routerrule.py +++ b/neutron/plugins/bigswitch/extensions/routerrule.py @@ -14,7 +14,7 @@ # under the License. from neutron.api.v2 import attributes as attr -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception from neutron.openstack.common import log as logging @@ -22,11 +22,11 @@ LOG = logging.getLogger(__name__) # Router Rules Exceptions -class InvalidRouterRules(qexception.InvalidInput): +class InvalidRouterRules(nexception.InvalidInput): message = _("Invalid format for router rules: %(rule)s, %(reason)s") -class RulesExhausted(qexception.BadRequest): +class RulesExhausted(nexception.BadRequest): message = _("Unable to complete rules update for %(router_id)s. " "The number of rules exceeds the maximum %(quota)s.") @@ -46,7 +46,7 @@ def convert_to_valid_router_rules(data): if not isinstance(data, list): emsg = _("Invalid data format for router rule: '%s'") % data LOG.debug(emsg) - raise qexception.InvalidInput(error_message=emsg) + raise nexception.InvalidInput(error_message=emsg) _validate_uniquerules(data) rules = [] expected_keys = ['source', 'destination', 'action'] @@ -66,7 +66,7 @@ def convert_to_valid_router_rules(data): errors = [m for m in errors if m] if errors: LOG.debug(errors) - raise qexception.InvalidInput(error_message=errors) + raise nexception.InvalidInput(error_message=errors) rules.append(rule) return rules @@ -98,7 +98,7 @@ def _validate_uniquerules(rules): if len(set(pairs)) != len(pairs): error = _("Duplicate router rules (src,dst) found '%s'") % pairs LOG.debug(error) - raise qexception.InvalidInput(error_message=error) + raise nexception.InvalidInput(error_message=error) class Routerrule(object): diff --git a/neutron/plugins/vmware/extensions/qos.py b/neutron/plugins/vmware/extensions/qos.py index ecc12e0b2..54cc64dcc 100644 --- a/neutron/plugins/vmware/extensions/qos.py +++ b/neutron/plugins/vmware/extensions/qos.py @@ -19,7 +19,7 @@ import abc from neutron.api import extensions from neutron.api.v2 import attributes as attr from neutron.api.v2 import base -from neutron.common import exceptions as qexception +from neutron.common import exceptions as nexception from neutron import manager @@ -30,42 +30,42 @@ qos_queue_get = "get_qos_queue" qos_queue_list = "get_qos_queues" -class DefaultQueueCreateNotAdmin(qexception.InUse): +class DefaultQueueCreateNotAdmin(nexception.InUse): message = _("Need to be admin in order to create queue called default") -class DefaultQueueAlreadyExists(qexception.InUse): +class DefaultQueueAlreadyExists(nexception.InUse): message = _("Default queue already exists.") -class QueueInvalidDscp(qexception.InvalidInput): +class QueueInvalidDscp(nexception.InvalidInput): message = _("Invalid value for dscp %(data)s must be integer value" " between 0 and 63.") -class QueueInvalidMarking(qexception.InvalidInput): +class QueueInvalidMarking(nexception.InvalidInput): message = _("The qos marking cannot be set to 'trusted' " "when the DSCP field is set") -class QueueMinGreaterMax(qexception.InvalidInput): +class QueueMinGreaterMax(nexception.InvalidInput): message = _("Invalid bandwidth rate, min greater than max.") -class QueueInvalidBandwidth(qexception.InvalidInput): +class QueueInvalidBandwidth(nexception.InvalidInput): message = _("Invalid bandwidth rate, %(data)s must be a non negative" " integer.") -class QueueNotFound(qexception.NotFound): +class QueueNotFound(nexception.NotFound): message = _("Queue %(id)s does not exist") -class QueueInUseByPort(qexception.InUse): +class QueueInUseByPort(nexception.InUse): message = _("Unable to delete queue attached to port.") -class QueuePortBindingNotFound(qexception.NotFound): +class QueuePortBindingNotFound(nexception.NotFound): message = _("Port is not associated with lqueue") @@ -78,7 +78,7 @@ def convert_to_unsigned_int_or_none(val): raise ValueError() except (ValueError, TypeError): msg = _("'%s' must be a non negative integer.") % val - raise qexception.InvalidInput(error_message=msg) + raise nexception.InvalidInput(error_message=msg) return val -- 2.45.2