XML_NS_V20 = 'http://openstack.org/quantum/api/v2.0'
FAULT_MAP = {exceptions.NotFound: webob.exc.HTTPNotFound,
- exceptions.InUse: webob.exc.HTTPConflict,
exceptions.Conflict: webob.exc.HTTPConflict,
+ exceptions.InUse: webob.exc.HTTPConflict,
exceptions.BadRequest: webob.exc.HTTPBadRequest,
- exceptions.ResourceExhausted: webob.exc.HTTPServiceUnavailable,
- exceptions.MacAddressGenerationFailure:
- webob.exc.HTTPServiceUnavailable,
- exceptions.StateInvalid: webob.exc.HTTPBadRequest,
- exceptions.InvalidInput: webob.exc.HTTPBadRequest,
- exceptions.OverlappingAllocationPools: webob.exc.HTTPConflict,
- exceptions.OutOfBoundsAllocationPool: webob.exc.HTTPBadRequest,
- exceptions.InvalidAllocationPool: webob.exc.HTTPBadRequest,
- exceptions.InvalidSharedSetting: webob.exc.HTTPConflict,
- exceptions.HostRoutesExhausted: webob.exc.HTTPBadRequest,
- exceptions.DNSNameServersExhausted: webob.exc.HTTPBadRequest,
- # Some plugins enforce policies as well
- exceptions.PolicyNotAuthorized: webob.exc.HTTPForbidden,
+ exceptions.ServiceUnavailable: webob.exc.HTTPServiceUnavailable,
+ exceptions.NotAuthorized: webob.exc.HTTPForbidden,
netaddr.AddrFormatError: webob.exc.HTTPBadRequest,
AttributeError: webob.exc.HTTPBadRequest,
ValueError: webob.exc.HTTPBadRequest,
- exceptions.IpAddressGenerationFailure: webob.exc.HTTPConflict,
- exceptions.OverQuota: webob.exc.HTTPConflict,
}
QUOTAS = quota.QUOTAS
message = _("Not authorized.")
+class ServiceUnavailable(QuantumException):
+ message = _("The service is unailable")
+
+
class AdminRequired(NotAuthorized):
message = _("User does not have admin privileges: %(reason)s")
message = _("Policy configuration policy.json could not be found")
-class StateInvalid(QuantumException):
+class StateInvalid(BadRequest):
message = _("Unsupported port state: %(port_state)s")
"The mac address %(mac)s is in use.")
-class HostRoutesExhausted(QuantumException):
+class HostRoutesExhausted(BadRequest):
# NOTE(xchenum): probably make sense to use quota exceeded exception?
message = _("Unable to complete operation for %(subnet_id)s. "
"The number of host routes exceeds the limit %(quota)s.")
-class DNSNameServersExhausted(QuantumException):
+class DNSNameServersExhausted(BadRequest):
# NOTE(xchenum): probably make sense to use quota exceeded exception?
message = _("Unable to complete operation for %(subnet_id)s. "
"The number of DNS nameservers exceeds the limit %(quota)s.")
"The tunnel ID %(tunnel_id)s is in use.")
-class TenantNetworksDisabled(QuantumException):
+class TenantNetworksDisabled(ServiceUnavailable):
message = _("Tenant network creation is not enabled.")
-class ResourceExhausted(QuantumException):
+class ResourceExhausted(ServiceUnavailable):
pass
"No tenant network is available for allocation.")
-class AlreadyAttached(QuantumException):
+class AlreadyAttached(Conflict):
message = _("Unable to plug the attachment %(att_id)s into port "
"%(port_id)s for network %(net_id)s. The attachment is "
"already plugged into port %(att_port_id)s")
"the requested subnet %(subnet_id)s")
-class MalformedRequestBody(QuantumException):
+class MalformedRequestBody(BadRequest):
message = _("Malformed request body: %(reason)s")
pass
-class InvalidInput(QuantumException):
+class InvalidInput(BadRequest):
message = _("Invalid input for operation: %(error_message)s.")
message = _("Invalid content type %(content_type)s.")
-class InvalidAllocationPool(QuantumException):
+class InvalidAllocationPool(BadRequest):
message = _("The allocation pool %(pool)s is not valid.")
-class OverlappingAllocationPools(QuantumException):
+class OverlappingAllocationPools(Conflict):
message = _("Found overlapping allocation pools:"
"%(pool_1)s %(pool_2)s for subnet %(subnet_cidr)s.")
-class OutOfBoundsAllocationPool(QuantumException):
+class OutOfBoundsAllocationPool(BadRequest):
message = _("The allocation pool %(pool)s spans "
"beyond the subnet cidr %(subnet_cidr)s.")
pass
-class FixedIPNotAvailable(QuantumException):
- message = _("Fixed IP (%(ip)s) unavailable for network "
- "%(network_uuid)s")
-
-
-class MacAddressGenerationFailure(QuantumException):
+class MacAddressGenerationFailure(ServiceUnavailable):
message = _("Unable to generate unique mac on network %(net_id)s.")
-class IpAddressGenerationFailure(QuantumException):
+class IpAddressGenerationFailure(Conflict):
message = _("No more IP addresses available on network %(net_id)s.")
message = _("Sudo priviledge is required to run this command.")
-class QuotaResourceUnknown(QuantumException):
+class QuotaResourceUnknown(NotFound):
message = _("Unknown quota resources %(unknown)s.")
-class OverQuota(QuantumException):
+class OverQuota(Conflict):
message = _("Quota exceeded for resources: %(overs)s")
-class InvalidQuotaValue(QuantumException):
+class InvalidQuotaValue(Conflict):
message = _("Change would make usage less than 0 for the following "
"resources: %(unders)s")
-class InvalidSharedSetting(QuantumException):
+class InvalidSharedSetting(Conflict):
message = _("Unable to reconfigure sharing settings for network "
"%(network)s. Multiple tenants are using it")
-class InvalidExtenstionEnv(QuantumException):
+class InvalidExtenstionEnv(BadRequest):
message = _("Invalid extension environment: %(reason)s")