diff --git a/placement/exception.py b/placement/exception.py index dccc53a61..7f7c8c2ae 100644 --- a/placement/exception.py +++ b/placement/exception.py @@ -11,11 +11,6 @@ # under the License. """Exceptions for use in the Placement API.""" -# NOTE(cdent): The exceptions are copied from nova.exception, where they -# were originally used. To prepare for extracting placement to its own -# repository we wish to no longer do that. Instead, exceptions used by -# placement should be in the placement hierarchy. - from oslo_log import log as logging from placement.i18n import _ @@ -161,8 +156,6 @@ class ResourceClassNotFound(NotFound): msg_fmt = _("No such resource class %(resource_class)s.") -# An exception with this name is used on both sides of the placement/ -# nova interaction. class ResourceProviderInUse(_BaseException): msg_fmt = _("Resource provider has allocations.") diff --git a/placement/objects/consumer.py b/placement/objects/consumer.py index 68b408d00..fc1c095a3 100644 --- a/placement/objects/consumer.py +++ b/placement/objects/consumer.py @@ -135,10 +135,11 @@ def _increment_consumer_generation(ctx, consumer): :param ctx: `nova.context.RequestContext` that contains an oslo_db Session :param consumer: `Consumer` whose generation should be updated. :returns: The newly-incremented generation. - :raises nova.exception.ConcurrentUpdateDetected: if another thread updated - the same consumer's view of its allocations in between the time - when this object was originally read and the call which modified - the consumer's state (e.g. replacing allocations for a consumer) + :raises placement.exception.ConcurrentUpdateDetected: if another thread + updated the same consumer's view of its allocations in between the + time when this object was originally read and the call which + modified the consumer's state (e.g. replacing allocations for a + consumer) """ consumer_gen = consumer.generation new_generation = consumer_gen + 1 @@ -241,7 +242,7 @@ class Consumer(base.VersionedObject, base.TimestampedObject): def increment_generation(self): """Increments the consumer's generation. - :raises nova.exception.ConcurrentUpdateDetected: if another thread + :raises placement.exception.ConcurrentUpdateDetected: if another thread updated the same consumer's view of its allocations in between the time when this object was originally read and the call which modified the consumer's state (e.g. replacing allocations for a diff --git a/placement/objects/resource_provider.py b/placement/objects/resource_provider.py index 10b2eb151..ace2683dc 100644 --- a/placement/objects/resource_provider.py +++ b/placement/objects/resource_provider.py @@ -264,10 +264,10 @@ def _increment_provider_generation(ctx, rp): :param ctx: `nova.context.RequestContext` that contains an oslo_db Session :param rp: `ResourceProvider` whose generation should be updated. :returns: The new resource provider generation value if successful. - :raises nova.exception.ConcurrentUpdateDetected: if another thread updated - the same resource provider's view of its inventory or allocations - in between the time when this object was originally read - and the call to set the inventory. + :raises placement.exception.ConcurrentUpdateDetected: if another thread + updated the same resource provider's view of its inventory or + allocations in between the time when this object was originally + read and the call to set the inventory. """ rp_gen = rp.generation new_generation = rp_gen + 1 @@ -337,10 +337,10 @@ def _set_inventory(context, rp, inv_list): :param inv_list: `InventoryList` object to save to backend storage. :returns: A list of (uuid, class) tuples that have exceeded their capacity after this inventory update. - :raises nova.exception.ConcurrentUpdateDetected: if another thread updated - the same resource provider's view of its inventory or allocations - in between the time when this object was originally read - and the call to set the inventory. + :raises placement.exception.ConcurrentUpdateDetected: if another thread + updated the same resource provider's view of its inventory or + allocations in between the time when this object was originally + read and the call to set the inventory. :raises `exception.ResourceClassNotFound` if any resource class in any inventory in inv_list cannot be found in either the standard classes or the DB.