summaryrefslogtreecommitdiff
path: root/ironic/db/api.py
diff options
context:
space:
mode:
authorKaifeng Wang <kaifeng.w@gmail.com>2018-11-23 17:12:03 +0800
committerKaifeng Wang <kaifeng.w@gmail.com>2018-11-29 10:25:16 +0800
commite2a768f0cd2abf6f2ac456949a8c46628b27b5ef (patch)
tree1720abdd541c51c74973ff2d7ecf1da02f962de7 /ironic/db/api.py
parentc5414620c5c3bd9b7085fd64f1dac40e83ec22df (diff)
downloadironic-e2a768f0cd2abf6f2ac456949a8c46628b27b5ef.tar.gz
Expose conductors: db and rpc
This patch lays some ground work around db and rpc to provide conductors information from the API. Changes in the db api and Conductor object is used to support the implementation of /v1/conductors. Adds an argument "online" to Conductor.get_by_hostname, so that we can get the conductor object from database even it's not online, this is required for the implementation of /v1/conductors/{hostname}. Adds a new interface get_conductor_for() to get the hostname of the conductor which is servicing the given node, it will be used for the implementation of /v1/nodes* endpoints, as well as listing nodes by given conductor. Story: 1724474 Task: 28064 Change-Id: I39a7a47c5ae649f6c3200e772a9357023f21a7c4
Diffstat (limited to 'ironic/db/api.py')
-rw-r--r--ironic/db/api.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/ironic/db/api.py b/ironic/db/api.py
index 518c8dea7..0ca10c1db 100644
--- a/ironic/db/api.py
+++ b/ironic/db/api.py
@@ -493,12 +493,29 @@ class Connection(object):
"""
@abc.abstractmethod
- def get_conductor(self, hostname):
+ def get_conductor_list(self, limit=None, marker=None,
+ sort_key=None, sort_dir=None):
+ """Return a list of conductors.
+
+ :param limit: Maximum number of conductors 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)
+ """
+
+ @abc.abstractmethod
+ def get_conductor(self, hostname, online=True):
"""Retrieve a conductor's service record from the database.
:param hostname: The hostname of the conductor service.
+ :param online: Specify the filter value on the `online` field when
+ querying conductors. The ``online`` field is ignored if
+ this value is set to None.
:returns: A conductor.
- :raises: ConductorNotFound
+ :raises: ConductorNotFound if the conductor with given hostname does
+ not exist or doesn't meet the specified online expectation.
"""
@abc.abstractmethod