| 1 |
# All rights reserved. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 |
# not use this file except in compliance with the License. You may obtain |
| 5 |
# a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 |
# License for the specific language governing permissions and limitations |
| 13 |
# under the License. |
| 14 |
|
| 15 |
from neutron_lib._i18n import _ |
| 16 |
from neutron_lib import exceptions |
| 17 |
|
| 18 |
|
| 19 |
class PlacementEndpointNotFound(exceptions.NotFound): |
| 20 |
message = _("Placement API endpoint not found.") |
| 21 |
|
| 22 |
|
| 23 |
class PlacementResourceNotFound(exceptions.NotFound): |
| 24 |
message = _("Placement resource not found on url: %(url)s.") |
| 25 |
|
| 26 |
|
| 27 |
class PlacementResourceProviderNotFound(exceptions.NotFound): |
| 28 |
message = _("Placement resource provider not found %(resource_provider)s.") |
| 29 |
|
| 30 |
|
| 31 |
class PlacementResourceProviderGenerationConflict(exceptions.Conflict): |
| 32 |
message = _("Placement resource provider generation does not match with " |
| 33 |
"the server side for resource provider: " |
| 34 |
"%(resource_provider)s with generation %(generation)s.") |
| 35 |
|
| 36 |
|
| 37 |
class PlacementInventoryNotFound(exceptions.NotFound): |
| 38 |
message = _("Placement inventory not found for resource provider " |
| 39 |
"%(resource_provider)s, resource class %(resource_class)s.") |
| 40 |
|
| 41 |
|
| 42 |
class PlacementInventoryUpdateConflict(exceptions.Conflict): |
| 43 |
message = _("Placement inventory update conflict for resource provider " |
| 44 |
"%(resource_provider)s, resource class %(resource_class)s.") |
| 45 |
|
| 46 |
|
| 47 |
class PlacementAggregateNotFound(exceptions.NotFound): |
| 48 |
message = _("Aggregate not found for resource provider " |
| 49 |
"%(resource_provider)s.") |
| 50 |
|
| 51 |
|
| 52 |
class PlacementTraitNotFound(exceptions.NotFound): |
| 53 |
message = _("Placement trait not found %(trait)s.") |
| 54 |
|
| 55 |
|
| 56 |
class PlacementResourceClassNotFound(exceptions.NotFound): |
| 57 |
message = _("Placement resource class not found %(resource_class)s") |
| 58 |
|
| 59 |
|
| 60 |
class PlacementAPIVersionIncorrect(exceptions.NotFound): |
| 61 |
message = _("Placement API version %(current_version)s, do not meet the " |
| 62 |
"needed version %(needed_version)s.") |
| 63 |
|
| 64 |
|
| 65 |
class PlacementResourceProviderNameNotUnique(exceptions.Conflict): |
| 66 |
message = _("Another resource provider exists with the provided name: " |
| 67 |
"%(name)s.") |
| 68 |
|
| 69 |
|
| 70 |
class PlacementClientError(exceptions.NeutronException): |
| 71 |
message = _("Placement Client Error (4xx): %(msg)s") |
| 72 |
|
| 73 |
|
| 74 |
class UnknownResourceProvider(exceptions.BadRequest): |
| 75 |
"""Resource provider not known by neutron backends.""" |
| 76 |
message = _("No such resource provider known by Neutron: %(rsc_provider)s") |
| 77 |
|
| 78 |
|
| 79 |
class AmbiguousResponsibilityForResourceProvider(exceptions.NeutronException): |
| 80 |
"""Not clear who's responsible for resource provider.""" |
| 81 |
message = _("Expected one driver to be responsible for resource provider " |
| 82 |
"%(rsc_provider)s, but got many: %(drivers)s") |
| 83 |
|
| 84 |
|
| 85 |
class PlacementAllocationGenerationConflict(exceptions.Conflict): |
| 86 |
message = _("Resource allocation has been changed for consumer " |
| 87 |
"%(consumer)s in Placement while Neutron tried to update it.") |
| 88 |
|
| 89 |
|
| 90 |
class PlacementAllocationRemoved(exceptions.BadRequest): |
| 91 |
message = _("Resource allocation is deleted for consumer %(consumer)s") |
| 92 |
|
| 93 |
|
| 94 |
class PlacementAllocationRpNotExists(exceptions.BadRequest): |
| 95 |
message = _("Resource provider %(resource_provider)s for %(consumer)s " |
| 96 |
"does not exist") |