Commit 7699c3af authored by Iustin Pop's avatar Iustin Pop
Browse files

Introduce a Luxi call for GetTags

This changes from submitting jobs to get the tags (in cli scripts) to
queries, which (since the tags query is a cheap one) should be much

The tags queries are already done without locks (in the generic query
paths for instances/nodes/cluster), so this shouldn't break tags query
via gnt-* list-tags.

On a small cluster, the runtime of gnt-cluster/gnt-instance list tags
more than halves; on a big cluster (with many MCs) I expect it to be
more than 5 times faster. The speed of the tags get is not the main
gain, it is eliminating a job when a simple query is enough.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarRené Nussbaumer <>
parent 47a72f18
......@@ -299,6 +299,12 @@ class ClientOps:
op = opcodes.OpQueryClusterInfo()
return self._Query(op)
elif method == luxi.REQ_QUERY_TAGS:
kind, name = args"Received tags query request")
op = opcodes.OpGetTags(kind=kind, name=name)
return self._Query(op)
elif method == luxi.REQ_QUEUE_SET_DRAIN_FLAG:
drain_flag = args"Received queue drain flag change request to %s",
......@@ -252,7 +252,6 @@ ARGS_ONE_INSTANCE = [ArgInstance(min=1, max=1)]
ARGS_ONE_NODE = [ArgNode(min=1, max=1)]
def _ExtractTagsObject(opts, args):
"""Extract the tag type object.
......@@ -313,8 +312,8 @@ def ListTags(opts, args):
kind, name = _ExtractTagsObject(opts, args)
op = opcodes.OpGetTags(kind=kind, name=name)
result = SubmitOpCode(op)
cl = GetClient()
result = cl.QueryTags(kind, name)
result = list(result)
for tag in result:
......@@ -56,6 +56,7 @@ REQ_QUERY_NODES = "QueryNodes"
REQ_QUERY_EXPORTS = "QueryExports"
REQ_QUERY_TAGS = "QueryTags"
......@@ -384,5 +385,8 @@ class Client(object):
def QueryConfigValues(self, fields):
return self.CallMethod(REQ_QUERY_CONFIG_VALUES, fields)
def QueryTags(self, kind, name):
return self.CallMethod(REQ_QUERY_TAGS, (kind, name))
# TODO: class Server(object)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment