summaryrefslogtreecommitdiff
path: root/ironic/db/api.py
diff options
context:
space:
mode:
authorDmitry Tantsur <divius.inside@gmail.com>2018-12-10 16:50:42 +0100
committerDmitry Tantsur <divius.inside@gmail.com>2019-01-07 12:51:10 +0100
commita4717d9958c5b434ab01afaca095e018db5aaa7d (patch)
treed6c1d4bb5019549570c344d787e2083ba74f9a44 /ironic/db/api.py
parentc10ee94b92174ce78073afc2eacb300fa649736f (diff)
downloadironic-a4717d9958c5b434ab01afaca095e018db5aaa7d.tar.gz
Allocation API: database and RPC
This change adds the database models and API, as well as RPC objects for the allocation API. Also the node database API is extended with query by power state and list of UUIDs. There is one discrepancy from the initially approved spec: since we do not have to separately update traits in an allocation, the planned allocation_traits table was replaced by a simple field. Change-Id: I6af132e2bfa6e4f7b93bd20f22a668790a22a30e Story: #2004341 Task: #28367
Diffstat (limited to 'ironic/db/api.py')
-rw-r--r--ironic/db/api.py79
1 files changed, 79 insertions, 0 deletions
diff --git a/ironic/db/api.py b/ironic/db/api.py
index c98880c7f..e43dc55da 100644
--- a/ironic/db/api.py
+++ b/ironic/db/api.py
@@ -1079,3 +1079,82 @@ class Connection(object):
:returns: A list of BIOSSetting objects.
:raises: NodeNotFound if the node is not found.
"""
+
+ @abc.abstractmethod
+ def get_allocation_by_id(self, allocation_id):
+ """Return an allocation representation.
+
+ :param allocation_id: The id of an allocation.
+ :returns: An allocation.
+ :raises: AllocationNotFound
+ """
+
+ @abc.abstractmethod
+ def get_allocation_by_uuid(self, allocation_uuid):
+ """Return an allocation representation.
+
+ :param allocation_uuid: The uuid of an allocation.
+ :returns: An allocation.
+ :raises: AllocationNotFound
+ """
+
+ @abc.abstractmethod
+ def get_allocation_by_name(self, name):
+ """Return an allocation representation.
+
+ :param name: The logical name of an allocation.
+ :returns: An allocation.
+ :raises: AllocationNotFound
+ """
+
+ @abc.abstractmethod
+ def get_allocation_list(self, filters=None, limit=None, marker=None,
+ sort_key=None, sort_dir=None):
+ """Return a list of allocations.
+
+ :param filters: Filters to apply. Defaults to None.
+
+ :node_uuid: uuid of node
+ :state: allocation state
+ :resource_class: requested resource class
+ :param limit: Maximum number of allocations to return.
+ :param marker: The last item of the previous page; we return the next
+ result set.
+ :param sort_key: Attribute by which results should be sorted.
+ :param sort_dir: Direction in which results should be sorted.
+ (asc, desc)
+ :returns: A list of allocations.
+ """
+
+ @abc.abstractmethod
+ def create_allocation(self, values):
+ """Create a new allocation.
+
+ :param values: Dict of values to create an allocation with
+ :returns: An allocation
+ :raises: AllocationDuplicateName
+ :raises: AllocationAlreadyExists
+ """
+
+ @abc.abstractmethod
+ def update_allocation(self, allocation_id, values, update_node=True):
+ """Update properties of an allocation.
+
+ :param allocation_id: Allocation ID
+ :param values: Dict of values to update.
+ :param update_node: If True and node_id is updated, update the node
+ with instance_uuid and traits from the allocation
+ :returns: An allocation.
+ :raises: AllocationNotFound
+ :raises: AllocationDuplicateName
+ :raises: InstanceAssociated
+ :raises: NodeAssociated
+ """
+
+ @abc.abstractmethod
+ def destroy_allocation(self, allocation_id):
+ """Destroy an allocation.
+
+ :param allocation_id: Allocation ID
+ :raises: AllocationNotFound
+ """