Merge "Add comments for deletion of ARQs by instance or ARQ UUIDs."
This commit is contained in:
commit
754b24156d
@ -214,6 +214,14 @@ class ARQsController(base.CyborgController):
|
|||||||
DELETE /v2/accelerator_requests?arqs=uuid1,uuid2,...
|
DELETE /v2/accelerator_requests?arqs=uuid1,uuid2,...
|
||||||
DELETE /v2/accelerator_requests?instance=uuid
|
DELETE /v2/accelerator_requests?instance=uuid
|
||||||
|
|
||||||
|
The second form is idempotent, i.e., it would have the same effect
|
||||||
|
if called repeatedly with the same instance UUID. In other words,
|
||||||
|
it would not raise an error on the second and later attempts even if
|
||||||
|
the first one has deleted the ARQs. Whereas the first form is not
|
||||||
|
idempotent: if one or more of the ARQs do not exist, it would raise
|
||||||
|
an error. Nova uses the second form: so repeated calls do not cause
|
||||||
|
issues.
|
||||||
|
|
||||||
:param arq: List of ARQ UUIDs
|
:param arq: List of ARQ UUIDs
|
||||||
:param instance: UUID of instance whose ARQs need to be deleted
|
:param instance: UUID of instance whose ARQs need to be deleted
|
||||||
"""
|
"""
|
||||||
|
@ -149,6 +149,12 @@ class ExtARQ(base.CyborgObject, object_base.VersionedObjectDictCompat,
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def delete_by_uuid(cls, context, arq_uuid_list):
|
def delete_by_uuid(cls, context, arq_uuid_list):
|
||||||
|
"""Delete a list of ARQs based on their UUIDs.
|
||||||
|
|
||||||
|
This is not idempotent, i.e., if the first call to delete an
|
||||||
|
ARQ has succeeded, second and later calls to delete the same ARQ
|
||||||
|
will get errored out.
|
||||||
|
"""
|
||||||
for uuid in arq_uuid_list:
|
for uuid in arq_uuid_list:
|
||||||
obj_extarq = objects.ExtARQ.get(context, uuid)
|
obj_extarq = objects.ExtARQ.get(context, uuid)
|
||||||
# TODO() Defer deletion to conductor
|
# TODO() Defer deletion to conductor
|
||||||
@ -158,7 +164,13 @@ class ExtARQ(base.CyborgObject, object_base.VersionedObjectDictCompat,
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def delete_by_instance(cls, context, instance_uuid):
|
def delete_by_instance(cls, context, instance_uuid):
|
||||||
"""Delete all ARQs for given instance."""
|
"""Delete all ARQs for given instance.
|
||||||
|
|
||||||
|
This is idempotent, i.e., it would have the same effect if called
|
||||||
|
repeatedly with the same instance UUID. In other words, it would
|
||||||
|
not raise an error on the second and later attempts even if the
|
||||||
|
first one has deleted the ARQs.
|
||||||
|
"""
|
||||||
obj_extarqs = [extarq for extarq in objects.ExtARQ.list(context)
|
obj_extarqs = [extarq for extarq in objects.ExtARQ.list(context)
|
||||||
if extarq.arq['instance_uuid'] == instance_uuid]
|
if extarq.arq['instance_uuid'] == instance_uuid]
|
||||||
for obj_extarq in obj_extarqs:
|
for obj_extarq in obj_extarqs:
|
||||||
|
Loading…
Reference in New Issue
Block a user