nova.exception -> placement.exception in docstrings and comment

A simple cleanup to adjust comments and docstrings to change
"nova.exception" to "placement.exception", including removing
some comments that are no longer relevant.

Change-Id: Ia91f89c8fb529382446342229b14387b2c898ddc
This commit is contained in:
Chris Dent 2018-09-15 11:57:10 -06:00
parent d4a730aad7
commit 44aea7f33a
3 changed files with 14 additions and 20 deletions

View File

@ -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.")

View File

@ -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

View File

@ -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.