Supports paginate query for two get nodes DB APIs
In DB APIs that return a list of nodes, limiting and sorting the output is necessary for a large number of output nodes. This is especially important for the GUI that uses the APIs where the view is limited. This patch adds limit, marker, sort_key and sort_dir to get_associated_nodes and get_unassociated_nodes DB APIs. Change-Id: Ia2c616fff65a03bace1244fe646bdf0cf5f30a29
This commit is contained in:
@@ -195,16 +195,20 @@ class Connection(api.Connection):
|
||||
sort_key, sort_dir, query)
|
||||
|
||||
@objects.objectify(objects.Node)
|
||||
def get_associated_nodes(self):
|
||||
def get_associated_nodes(self, limit=None, marker=None,
|
||||
sort_key=None, sort_dir=None):
|
||||
query = model_query(models.Node).\
|
||||
filter(models.Node.instance_uuid != None)
|
||||
return query.all()
|
||||
filter(models.Node.instance_uuid != None)
|
||||
return _paginate_query(models.Node, limit, marker,
|
||||
sort_key, sort_dir, query)
|
||||
|
||||
@objects.objectify(objects.Node)
|
||||
def get_unassociated_nodes(self):
|
||||
def get_unassociated_nodes(self, limit=None, marker=None,
|
||||
sort_key=None, sort_dir=None):
|
||||
query = model_query(models.Node).\
|
||||
filter(models.Node.instance_uuid == None)
|
||||
return query.all()
|
||||
filter(models.Node.instance_uuid == None)
|
||||
return _paginate_query(models.Node, limit, marker,
|
||||
sort_key, sort_dir, query)
|
||||
|
||||
@objects.objectify(objects.Node)
|
||||
def reserve_nodes(self, tag, nodes):
|
||||
|
||||
Reference in New Issue
Block a user